>
> > hello,
> >
> > I'm trying to use the "CREATE TABLE AS" syntax to create a table and
> > insert
> > in the same time a default row.
> >
> > e.g :
> >
> > sqlite> CREATE TABLE test (x NUMERIC) AS (SELECT 25 AS x);
> > Error: near "AS": syntax error
> >
> > oops.
> >
> > this syntax is documented in http://www.sqlite.org/lang_createtable.html
> > sqlite version is 3.6.20
> >
> > any idea ? thanks for any help,
>
>
> Dan Kennedy wrote:
>
> The diagram is meant to be interpreted such that a CREATE TABLE
> may have either a list of columns in parenthesis or an "AS SELECT"
> clause. Not both.
>
 > http://www.sqlite.org/syntaxdiagrams.html#create-table-stmt
>

>
> Andy wrote:
> I believe you either specify the column definitions *OR* use the "AS
> clause - i.e.
> CREATE TABLE test (x NUMERIC)
>
> *OR*
>
> CREATE TABLE test AS SELECT 25 AS x;
> Does this help?
>

sure it helped.
it works now with the correct syntax,
thanks to Dann & Andy.

Tom
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to