[DB-SIG] Sybase create table
craftereric at hotmail.com
Fri Jul 14 20:21:54 CEST 2006
I posed this question to the Python Sybase group and was told to post it
here in hopes a getting an answer.
I have Sybase syntax like following:
create table xxxdelete (
Since login is a Sybase reserved word it needs to be in double quotes. I
have checked through the Sybase gui that this works. My problem is that I
am creating a Python script to do this and I get a syntax error. I can't
figure out where I am going wrong. Here is what I did:
db = Sybase.connect('cipherpoc', 'dba', 'SQL')
cursor = db.cursor ()
print ( "CREATE TABLE xxxdelete ( \" login \" varchar(233) )" ) ---->
CREATE TABLE xxxdelete ( " login " varchar(233) )
If I take the above output and paste into my Sybase gui tool, I have
verified that the table gets created successfully.
Similarly, the statement
print ('''CREATE TABLE xxxdelete ("login" varchar(233) )''') outputs
CREATE TABLE xxxdelete ("login" varchar(233) )
which also creates the table successfully.
However this statement fails no one can figure out why:
cursor.execute ( "CREATE TABLE xxxdelete ( \" login \" varchar(233) )" )
----> same info as the above print statement
ASA Error -131: Syntax error near ' login ' on line 1
Express yourself instantly with MSN Messenger! Download today - it's FREE!
More information about the DB-SIG