Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Table problem (database)

Status
Not open for further replies.

krappleby025

Programmer
Sep 6, 2001
347
NL
Hi all,

Im using the following command to create a table in a MS SQL version 7 database

con.execute("CREATE TABLE memberoffers (memoffid mediumint( 10 ) NOT NULL default '0',offerid mediumint( 10 ) NOT NULL default '0',memberid varchar( 200 ) NOT NULL default '',amount varchar( 50 ) NOT NULL default '',date varchar( 14 ) default NULL ,paid varchar( 10 ) NOT NULL default '',open varchar( 10 ) NOT NULL default 'YES',duration varchar( 10 ) NOT NULL default '') TYPE = MyISAM ;")

But its comming back with the following error

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'open'.

/databasesetup.asp, line 3

any ideas what is wrong...

Thanks
 
try to enclose the field name open with bracket. open is reserved word in SQL Server..
 
date is also reserved...

con.execute("CREATE TABLE memberoffers (memoffid mediumint( 10 ) NOT NULL default '0',offerid mediumint( 10 ) NOT NULL default '0',memberid varchar( 200 ) NOT NULL default '',amount varchar( 50 ) NOT NULL default '',[date] varchar( 14 ) default NULL ,paid varchar( 10 ) NOT NULL default '',[open] varchar( 10 ) NOT NULL default 'YES',duration varchar( 10 ) NOT NULL default '') TYPE = MyISAM ;")

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top