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
 What am I messing up here?

Author  Topic 

kdnichols
Posting Yak Master

232 Posts

Posted - 2007-02-14 : 15:10:07
Hello,

I keep getting the following error message:

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

I have tried putting in a , at the end and a semi colon.

Here is the code


Use QAgent
INSERT INTO AgentInfo
(SYSTEM, PRIN, FIRSTNAME, LASTNAME, REP#, MANAGER, EID_VID, Email, AccessLevel)
(Div, All, Curt, Logan, , E057803, ' ', E067892, curtis.logan@twcable.com, PAC)


I know this is easy and I will probably feel stupid afterward, but what am I doing wrong?

Thanks,

kurt

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-02-14 : 15:14:03
First of all, column names can't contain a #, so you'll need to put that column in [], and your values all look like character literals so they need to be in quotes, like this

INSERT INTO AgentInfo
(SYSTEM, PRIN, FIRSTNAME, LASTNAME, [REP#], MANAGER, EID_VID, Email, AccessLevel)
('Div', 'All', 'Curt', 'Logan', , 'E057803', ' ', 'E067892', 'curtis.logan@twcable.com', 'PAC')
Go to Top of Page

kdnichols
Posting Yak Master

232 Posts

Posted - 2007-02-14 : 15:55:10
Hello SNSQL,

Thanks one more thing you must put values in front of the statement and have the INSERT INTO for every record, but I was able to get it done.

It should be like this:


Use QAgent
INSERT INTO AgentInfo
(SYSTEM, PRIN, FIRSTNAME, LASTNAME, REP#, MANAGER, EID_VID, Email, AccessLevel)
VALUES (Div, All, Curt, Logan, , E057803, ' ', E067892, curtis.logan@twcable.com, PAC)


Thanks for the info.

Have a great day!



Kurt
Go to Top of Page
   

- Advertisement -