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
 Incorrect Syntax Near.... AAHH!!!

Author  Topic 

rhinton21
Starting Member

10 Posts

Posted - 2008-10-08 : 15:49:08
Could someone please help me with this script. I created the database already now I need to create these tables. But I keep getting:

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

Ahhhh!!! I dont know where its going wrong. Could somebody help me please!!!

drop table es_surv_result_tb;

create table es_surv_result_tb
(
SURV_HELPFUL smallint NOT NULL,
SURV_RESOURCES smallint NOT NULL,
SURV_WORKSPACE smallint NOT NULL,
SURV_RECOGNITION smallint NOT NULL,
SURV_SALARY smallint NOT NULL,
SURV_WORKLOAD smallint NOT NULL,
SURV_TEAMWORK smallint NOT NULL,
SURV_CONCERNS smallint NOT NULL,
SURV_MGT_LISTENS smallint NOT NULL,
SURV_ADMIN_LISTENS smallint NOT NULL,
SURV_MGT_ENCOURAGE smallint NOT NULL,
SURV_ADMIN_ENCOURAGE smallint NOT NULL,
SURV_MGT_COMMUN smallint NOT NULL,
SURV_ADMIN_COMMUN smallint NOT NULL,
SURV_SUPERVISION smallint NOT NULL,
SURV_TREATMENT smallint NOT NULL,
SURV_TRAINING smallint NOT NULL,
SURV_OJT smallint NOT NULL,
SURV_COACHING smallint NOT NULL,
SURV_RECOMMEND smallint NOT NULL,
SURV_LIKE smallint NOT NULL,
SURV_CHANGES_1 smallint NOT NULL DEFAULT,
SURV_CHANGES_2 smallint NOT NULL DEFAULT,
SURV_CHANGES_3 smallint NOT NULL DEFAULT,
SURV_CHANGES_4 smallint NOT NULL DEFAULT,
SURV_CHANGES_5 smallint NOT NULL DEFAULT,
SURV_CHANGES_6 smallint NOT NULL DEFAULT,
SURV_CHANGES_7 smallint NOT NULL DEFAULT,
SURV_CHANGES_8 smallint NOT NULL DEFAULT,
SURV_CHANGES_9 smallint NOT NULL DEFAULT,
SURV_LOCATION smallint NOT NULL,
SURV_RACE smallint NOT NULL DEFAULT,
SURV_GENDER smallint NOT NULL DEFAULT,
SURV_LEN_EMP smallint NOT NULL,
SURV_HIGH_EDU smallint NOT NULL DEFAULT,
SURV_BACH smallint NOT NULL,
SURV_ADV_DEGREE smallint NOT NULL,
SURV_DESC_JOB smallint NOT NULL,
SURV_VERSION smallint NOT NULL DEFAULT 1,
SURV_DATE timestamp NOT NULL,
SURV_COMMENTS varchar(2500) NOT NULL DEFAULT

);

drop table es_surv_login_tb;

create table es_surv_login_tb
(
SURV_LOGIN_ID varchar(16) NOT NULL,
SURV_LOGIN_DATE TIMESTAMP NOT NULL
);

drop table es_surv_location_tb;

create table es_surv_location_tb
(
SURV_LOCATION smallint NOT NULL,
SURV_LOCATION_DESC varchar(100) NOT NULL
);

INSERT INTO es_surv_location_tb
VALUES
( 1, 'Orleans District' ) ,
( 2, 'Jefferson District' ),
( 3, 'Baton Rouge Region' ),
( 4, 'Covington Region' ),
( 5, 'Thibodaux Region' ),
( 6, 'Lafayette Region' ),
( 7, 'Lake Charles Region' ),
( 8, 'Alexandria Region' ),
( 9, 'Shreveport Region' ),
( 10, 'Monroe Region' ),
( 11, 'State Office' );

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-08 : 15:53:20
quote:
Originally posted by rhinton21

Could someone please help me with this script. I created the database already now I need to create these tables. But I keep getting:

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

Ahhhh!!! I dont know where its going wrong. Could somebody help me please!!!

drop table es_surv_result_tb;

create table es_surv_result_tb
(
SURV_HELPFUL smallint NOT NULL,
SURV_RESOURCES smallint NOT NULL,
SURV_WORKSPACE smallint NOT NULL,
SURV_RECOGNITION smallint NOT NULL,
SURV_SALARY smallint NOT NULL,
SURV_WORKLOAD smallint NOT NULL,
SURV_TEAMWORK smallint NOT NULL,
SURV_CONCERNS smallint NOT NULL,
SURV_MGT_LISTENS smallint NOT NULL,
SURV_ADMIN_LISTENS smallint NOT NULL,
SURV_MGT_ENCOURAGE smallint NOT NULL,
SURV_ADMIN_ENCOURAGE smallint NOT NULL,
SURV_MGT_COMMUN smallint NOT NULL,
SURV_ADMIN_COMMUN smallint NOT NULL,
SURV_SUPERVISION smallint NOT NULL,
SURV_TREATMENT smallint NOT NULL,
SURV_TRAINING smallint NOT NULL,
SURV_OJT smallint NOT NULL,
SURV_COACHING smallint NOT NULL,
SURV_RECOMMEND smallint NOT NULL,
SURV_LIKE smallint NOT NULL,
SURV_CHANGES_1 smallint NOT NULL DEFAULT,
SURV_CHANGES_2 smallint NOT NULL DEFAULT,
SURV_CHANGES_3 smallint NOT NULL DEFAULT,
SURV_CHANGES_4 smallint NOT NULL DEFAULT,
SURV_CHANGES_5 smallint NOT NULL DEFAULT,
SURV_CHANGES_6 smallint NOT NULL DEFAULT,
SURV_CHANGES_7 smallint NOT NULL DEFAULT,
SURV_CHANGES_8 smallint NOT NULL DEFAULT,
SURV_CHANGES_9 smallint NOT NULL DEFAULT,
SURV_LOCATION smallint NOT NULL,
SURV_RACE smallint NOT NULL DEFAULT,
SURV_GENDER smallint NOT NULL DEFAULT,
SURV_LEN_EMP smallint NOT NULL,
SURV_HIGH_EDU smallint NOT NULL DEFAULT,
SURV_BACH smallint NOT NULL,
SURV_ADV_DEGREE smallint NOT NULL,
SURV_DESC_JOB smallint NOT NULL,
SURV_VERSION smallint NOT NULL DEFAULT 1,
SURV_DATE timestamp NOT NULL,
SURV_COMMENTS varchar(2500) NOT NULL DEFAULT

);
drop table es_surv_login_tb;

create table es_surv_login_tb
(
SURV_LOGIN_ID varchar(16) NOT NULL,
SURV_LOGIN_DATE TIMESTAMP NOT NULL
);

drop table es_surv_location_tb;

create table es_surv_location_tb
(
SURV_LOCATION smallint NOT NULL,
SURV_LOCATION_DESC varchar(100) NOT NULL
);

INSERT INTO es_surv_location_tb ( columns)
VALUES
( 1, 'Orleans District' ) ,
( 2, 'Jefferson District' ),
( 3, 'Baton Rouge Region' ),
( 4, 'Covington Region' ),
( 5, 'Thibodaux Region' ),
( 6, 'Lafayette Region' ),
( 7, 'Lake Charles Region' ),
( 8, 'Alexandria Region' ),
( 9, 'Shreveport Region' ),
( 10, 'Monroe Region' ),
( 11, 'State Office' );



Go to Top of Page

rhinton21
Starting Member

10 Posts

Posted - 2008-10-08 : 15:59:13
Thanks so much, but Im still getting this even after I added the column values)

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

Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-08 : 16:01:13
You need to specify what default you are looking for.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-08 : 16:03:41
DEFAULT to what value?

And this only works with SQL Server 2008 and later
INSERT INTO es_surv_location_tb 
VALUES
( 1, 'Orleans District' ) ,
( 2, 'Jefferson District' ),
( 3, 'Baton Rouge Region' ),
( 4, 'Covington Region' ),
( 5, 'Thibodaux Region' ),
( 6, 'Lafayette Region' ),
( 7, 'Lake Charles Region' ),
( 8, 'Alexandria Region' ),
( 9, 'Shreveport Region' ),
( 10, 'Monroe Region' ),
( 11, 'State Office' );



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-08 : 16:06:13
Default to this value:

SURV_CHANGES_1 smallint NOT NULL DEFAULT ????,
SURV_CHANGES_2 smallint NOT NULL DEFAULT,
SURV_CHANGES_3 smallint NOT NULL DEFAULT,
SURV_CHANGES_4 smallint NOT NULL DEFAULT,
SURV_CHANGES_5 smallint NOT NULL DEFAULT,
SURV_CHANGES_6 smallint NOT NULL DEFAULT,
SURV_CHANGES_7 smallint NOT NULL DEFAULT,
SURV_CHANGES_8 smallint NOT NULL DEFAULT,
SURV_CHANGES_9 smallint NOT NULL DEFAULT,
SURV_LOCATION smallint NOT NULL,
SURV_RACE smallint NOT NULL DEFAULT,
SURV_GENDER smallint NOT NULL DEFAULT,
SURV_LEN_EMP smallint NOT NULL,
SURV_HIGH_EDU smallint NOT NULL DEFAULT,
SURV_BACH smallint NOT NULL,
SURV_ADV_DEGREE smallint NOT NULL,
SURV_DESC_JOB smallint NOT NULL,
SURV_VERSION smallint NOT NULL DEFAULT 1,
SURV_DATE timestamp NOT NULL,
SURV_COMMENTS varchar(2500) NOT NULL DEFAULT
Go to Top of Page
   

- Advertisement -