Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store a column as a string in kdb

Tags:

q-lang

kdb+

I have a table with numerous columns. I'm trying to take the data from one of the columns and return it as a string.

For instance, if I had:

A B C
1 2 3
4 5 6
7 8 9

I would like to take column B and store 258 as a string. How would I do this?

like image 412
Jonathan Avatar asked Dec 09 '25 10:12

Jonathan


1 Answers

Like this?

q)raze exec string B from ([] A:1 4 7;B:2 5 8;C:3 6 9)
"258"

Or are you trying to change the type of the column in the table?

q)update string B from ([] A:1 4 7;B:2 5 8;C:3 6 9)
A B    C
--------
1 ,"2" 3
4 ,"5" 6
7 ,"8" 9
like image 129
terrylynch Avatar answered Dec 12 '25 03:12

terrylynch