Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error creating table

Author  Topic 

raindear
Yak Posting Veteran

64 Posts

Posted - 2014-05-27 : 08:17:50
Have been given this code to create a table

CREATE TABLE 'emaillist' (
'id' INT(11) NOT NULL AUTO_INCREMENT,
'clientname' VARCHAR(200) NOT NULL DEFAULT '0',
'email' VARCHAR(200) NOT NULL DEFAULT '0',
PRIMARY KEY ('id')
);

when I execute it says

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'emaillist'.

Any idea what the correct code should be?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2014-05-27 : 08:38:24
This looks like MySQL.
We are on MS SQL Server only here.



Too old to Rock'n'Roll too young to die.
Go to Top of Page

GouravSaxena1987
Starting Member

23 Posts

Posted - 2014-05-27 : 13:09:57
Check it SET QUOTED_IDENTIFIER is ON/OFF

It should be on for execute your query in SQL Server and since it doesn't allowed to have name with " ' " , you have to replance single quote (') with double quote (").

Regards,
Gourav Saxena
Data Warehouse Counsultant
GouravSaxena1987@gmail.com
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2014-05-28 : 01:38:44
It's MySQL, should work without the ''

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -