Unix Technical Forum

Incorrect syntax near ','

This is a discussion on Incorrect syntax near ',' within the SQL Server forums, part of the Microsoft SQL Server category; --> Hey all I need help to fix this problem. I run a query like this: INSERT INTO [RDI_Test.Deleted].dbo.[Nominee]([Given Name],[Surname], ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-12-2008, 05:23 PM
ghozan
 
Posts: n/a
Default Incorrect syntax near ','

Hey all I need help to fix this problem.
I run a query like this:

INSERT INTO [RDI_Test.Deleted].dbo.[Nominee]([Given Name],[Surname],
[OwnerID],[TitleID]) SELECT ([Given Name],[Surname],[OwnerID],
[TitleID]) FROM #Temp_Deleted

and got this error:

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

Can anyone point out the problem? Thank you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-12-2008, 05:23 PM
Plamen Ratchev
 
Posts: n/a
Default Re: Incorrect syntax near ','

There is no need to use parenthesis for the columns in the select list:

INSERT INTO [RDI_Test.Deleted].dbo.[Nominee](
[Given Name],
[Surname],
[OwnerID],
[TitleID])
SELECT [Given Name],
[Surname],
[OwnerID],
[TitleID]
FROM #Temp_Deleted;


--
Plamen Ratchev
http://www.SQLStudio.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-12-2008, 05:23 PM
ghozan
 
Posts: n/a
Default Re: Incorrect syntax near ','

Thanks for the solution. It solved my headache.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads for: Incorrect syntax near ','

Thread Thread Starter Forum Replies Last Post
Incorrect syntax near the keyword 'WHERE'. DaveF SQL Server 1 03-01-2008 02:40 PM
Line 1: Incorrect syntax near Sandesh SQL Server 1 02-29-2008 08:35 PM
Line 1: Incorrect syntax near '=' Assimalyst SQL Server 3 02-29-2008 09:38 AM
A story of incorrect syntax theintrepidfox@hotmail.com SQL Server 4 02-29-2008 07:15 AM
Incorrect Syntax GitarJake SQL Server 5 02-29-2008 04:41 AM


All times are GMT. The time now is 04:50 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com