...

View Full Version : ASP/SQL: Creating a table in database



BarrMan
09-23-2007, 10:19 PM
Hey.
I'd like to create a table in an existing database but it doesn't seem to work.
I get this error when trying to execute the SQL statement:

Microsoft JET Database Engine (0x80040E14)
Syntax error in CREATE TABLE statement.
/system/installation.asp, line 188

This is how my statement looks like:

CREATE TABLE Insert table name (id INT NOT NULL AUTO_INCREMENT,test1 VARCHAR,test2, test3 VARCHAR, PRIMARY KEY id);

What am I doing wrong?

Thanks for the help!

miranda
09-24-2007, 05:07 AM
Your create table code is wrong. There is no insert table. The code is


CREATE TABLE TableName
(
id int IDENTITY NOT NULL PRIMARY KEY CLUSTERED,
text1 varchar(50),
text2 text,
text3 varchar(75)
)

BarrMan
09-24-2007, 07:22 PM
Thanks Miranda!
I knew there wasn't an SQL statement as this but I got this value of a form value and that's why it caused the error.
I just didn't notice it.

Thanks again :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum