Hello Vajindar,
I think your problem is the way you are trying to cast as a string within your empty table, also you are getting a rank error because you are adding the value `string as a symbol in both dname and location, instead you could use:
q)deptTable:([deptno:`int$()] dname:string();loction:string())q)deptTable:([deptno:"I"$()] dname:"C"$();loction:"C"$())
q)deptTable
deptno| dname loction
------| -------------
q)meta deptTable
c <wbr style='"box-sizing:' inherit> <wbr style='"box-sizing:' inherit> <wbr style='"box-sizing:' inherit>| t f a<br style='"box-sizing:' inherit>-------| -----<br style='"box-sizing:' inherit>deptno | i<br style='"box-sizing:' inherit>dname <wbr style='"box-sizing:' inherit>| c<br style='"box-sizing:' inherit>loction| c<br style='"box-sizing:' inherit>q)deptTable:([deptno:`int$()] dname:"C"$();loction:"C"$())<br style='"box-sizing:' inherit>q)deptTable:([deptno:`int$()] dname:`char$();loction:`char$())</wbr></wbr></wbr></wbr>
The first line shows your query fixed and now assigns an empty list to both dname and location casted as strings.
In the second line there we cast to a string using āCā instead of string. This can also be done using
char$() as shown at the end!
Andrew McNaught.