Empty table declaration

Hi ,

?

I have declared an empty table as t:( c1:int$();c2:int$())

Now I want to insert compound column data like

c1??? c2

–??? —

10??? 20 30

the statement `t insert (10; 20 30) didn’t work.But if I declare the table without specifying null list of the type,then it is working.

i.e? t:( c1:`int$();c2:()) works.

Is there any way to fix the type for the?columns of the?general lists before inserting first item.

?

Regards,

no, () is an empty list with type 0 - there’s no way to embed the type of a nested list there.

Also note that

meta t

will take the type of the first element, and assume that the remaining elements are of the same type as that element; this is not always correct. e.g.

q)meta (a:(1 2;ab))

c| t f a

-| -----

a| J 

there is a hacking way I am using, leave it to be general list whenfirstly define the table, and then insert a sample data. in that way,q will recognize the table schema by checking the first record.here “I” means list of integers, this can be applied to “C” (string)as wellq)a:(c1:int$();c2:())q)insert [a; (1;1 2)],0q)meta ac | t f a–| -----c1| ic2| Iq)On Jun 4, 4:29?pm, Q_developer <qba…> wrote:> Hi ,>> I have declared an empty table as t:( c1:int$();c2:int$())> Now I want to insert compound column data like> c1 ? ? c2> – ? ? ? —> 10 ? ? 20 30> the statement t insert (10; 20 30) didn't work.But if I declare the table&gt; without specifying null list of the type,then it is working.&gt; i.e ?t:([] c1:int$();c2:()) works.> Is there any way to fix the type for the columns of the general lists> before inserting first item.>> Regards,</qba…>

To: personal-kdbplus@googlegroups.comX-Mailer: Apple Mail (2.1278)that’s no hacking. it is the way to define a column with nested data.On 4 Jun 2012, at 18:29, Sean wrote:> there is a hacking way I am using, leave it to be general list when> firstly define the table, and then insert a sample data. in that way,> q will recognize the table schema by checking the first record.> > here “I” means list of integers, this can be applied to “C” (string)> as well> > q)a:(c1:int$();c2:())\> q)insert [a; (1;1 2)]> ,0> q)meta a> c | t f a> --| -----> c1| i> c2| I> q)> > > On Jun 4, 4:29 pm, Q_developer <qba…> wrote:>> Hi ,>> >> I have declared an empty table as t:( c1:int$();c2:int$())>> Now I want to insert compound column data like>> c1 c2>> – —>> 10 20 30>> the statement t insert (10; 20 30) didn't work.But if I declare the table&gt;&gt; without specifying null list of the type,then it is working.&gt;&gt; i.e t:([] c1:int$();c2:()) works.>> Is there any way to fix the type for the columns of the general lists>> before inserting first item.>> >> Regards,> > – >

Submitted via Google Groups</qba…>