How to rename the column name of a table according to a variable

Received: by 10.100.216.12 with SMTP id o12mr122018ang.27.1236238769981; Wed, 04 Mar 2009 23:39:29 -0800 (PST)Date: Wed, 4 Mar 2009 23:39:29 -0800 (PST)X-IP: 221.223.74.134User-Agent: G2/1.0X-Google-Token: Kprb3gwAAAAApLZjCBLZAsw1OktPz3giX-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.48 Safari/525.19,gzip(gfe),gzip(gfe)Message-ID: <5c245cbb-ff09-49bb-861d-96f40356833c@r10g2000prf.googlegroups.com>Subject: How to rename the column name of a table according to a variableFrom: Wind To: “Kdb+ Personal Developers” X-Google-Approved: charlie@kx.com via web at 2009-03-05 08:09:28We could change col names with xcol:q)cols bsymdatecloseq)b:symdateibm.close xcol bq)cols bsymdateibm.closeThe questions are as following:1. could we change the col names according to a variable? such as :q)x:GOOGq)symdate`$(string x) xcol b’nyi2. whether xcol is the efficient method changing name of columns.Thanks.

yes

q)(symdate,`$string x) xcol b

xcol is very efficient

Date: Thu, 5 Mar 2009 08:35:13 +0000Message-ID: <1855e77f0903050035h6c0f893ch88644f21b76840b4@mail.gmail.com>Subject: Re: [personal kdb+] Re: How to rename the column name of a table according to a variableFrom: Attila Vrabecz <attila.vrabecz>To: personal-kdbplus@googlegroups.com(symdate,x) xcol bis enough if x is already a symbol AttilaOn Thu, Mar 5, 2009 at 8:18 AM, Charlie Skelton,Kx wrote:> yes> q)(symdate,$string x) xcol b&gt;&gt; xcol is very efficient&gt; On Thu, Mar 5, 2009 at 8:39 AM, Wind <windspeedo99> wrote:&gt;&gt;&gt;&gt; We could change col names with xcol:&gt;&gt; q)cols b&gt;&gt; symdateclose>> q)b:symdateibm.close xcol b&gt;&gt; q)cols b&gt;&gt; symdateibm.close>>>> The questions are as following:>> 1. could we change the col names according to a variable? ?such as :>> q)x:GOOG&gt;&gt; q)symdate$(string x) xcol b>> 'nyi>>>> 2. whether xcol is the efficient method changing name of columns.>>>> Thanks.>>>>>>>>> >></attila.vrabecz>

Great. That works well.Thanks AttilaWindOn Mar 5, 4:35?pm, Attila Vrabecz <attila.vrab…> wrote:> (symdate,x) xcol b> is enough if x is already a symbol> ? Attila>> On Thu, Mar 5, 2009 at 8:18 AM, Charlie Skelton,Kx <char…> wrote:> > yes> > q)(symdate,$string x) xcol b&gt;&gt; &gt; xcol is very efficient&gt; &gt; On Thu, Mar 5, 2009 at 8:39 AM, Wind <windspeed...> wrote:&gt;&gt; &gt;&gt; We could change col names with xcol:&gt; &gt;&gt; q)cols b&gt; &gt;&gt; symdateclose> >> q)b:symdateibm.close xcol b&gt; &gt;&gt; q)cols b&gt; &gt;&gt; symdateibm.close>> >> The questions are as following:> >> 1. could we change the col names according to a variable? ?such as :> >> q)x:GOOG&gt; &gt;&gt; q)symdate$(string x) xcol b> >> 'nyi>> >> 2. whether xcol is the efficient method changing name of columns.>> >> Thanks.</windspeed…></char…></attila.vrab…>