• Welcome, Guest. Please login.
 
May 07, 2021, 09:49:37 PM

News:

Welcome to the SQLitening support forums!


add column with varname 'as'

Started by WiglWagl, June 28, 2015, 04:05:06 PM

Previous topic - Next topic

WiglWagl

Hi,

is there any known problem with the varname "as". I try to add a column named "as". Ok that works fine, but
i ca't insert any item on this table, because there is a problem with the column 'as':  :P

Any idesas?

Thanks
regards
Rene

cj

June 29, 2015, 11:15:15 AM #1 Last Edit: June 29, 2015, 11:26:46 AM by cj
https://www.sqlite.org/lang_keywords.html

It is a reserved word so create fails in this example.

#INCLUDE "sqlitening.inc"
FUNCTION PBMAIN () AS LONG
  LOCAL s() AS STRING
  slopen "sample.db3","C"
  slexe "drop table if exists t1"
  slexe "create table if not exists t1(as)"
  slexe "insert into t1 values('a')"
  slselAry "select * from t1",s(),"Q9"
  ? JOIN$(s(),$CR)
END FUNCTION           

The docs show some ways to modify the 'keyword', but I wouldn't do it.
#INCLUDE "sqlitening.inc"
FUNCTION PBMAIN () AS LONG
  LOCAL s() AS STRING
  slopen "sample.db3","C"
  slexe "drop table if exists t1"
  slexe "create table if not exists t1([as])"
  slexe "insert into t1 values('a')"
  slselAry "select [as] from t1",s(),"Q9"
  ? JOIN$(s(),$CR)
END FUNCTION