Home › Forums › kdb+ › Removing quotation from a column name › Reply To: Removing quotation from a column name
-
The syntax for xcols is `newName xcol tableName , because it looks like you are sending the query over a handle you have to do either h_feed “`newName xcol tableName” or h_feed(xcol;`newName;tableName)
Note that xcol renames the first column to the first symbol. so if your update_date is at position n you need n-1 column names before on the left side. Not sure if that makes sense but you can read the documentation about xcol here https://code.kx.com/q/ref/cols/#xcol
You can also use .Q.id to sanitise your column names
(base) alexanderunterrainer@Alexanders-Laptop:~|⇒ cat table.csv
“”update_date*””,goodName
1,2
3,4
5,6
q)t:(“II”;enlist csv) 0:`table.csv
q)t
“update_date*” goodName
———————–
1 2
3 4
5 6
q).Q.id t
update_date goodName
——————–
1 2
3 4
5 6
or using xcol
q)`newGoodName xcol t
newGoodName goodName
——————–
1 2
3 4
5 6
code.kx.com
cols, xcol, xcols | Reference | kdb+ and q documentation - kdb+ and q documentation
cols, xcol and xcols are q keywords. cols returns the column names of a table. xcol renames tablecolumns. xcols reorders table columns.