469,602 Members | 1,650 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Syntax error

19
I am writing a dynamic query
Expand|Select|Wrap|Line Numbers
  1. insert into Tablename select '1111',
  2. name,address,phone,'1111', exec usp_storedProcedureName '1111', '1111', 'KA','EA'
  3. from edi856Item
  4. where autoid = '1111'
I dont know why I am getting this error i think there is some syntax error:

Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'exec'.
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'from'.

Can anyone help please
Apr 8 '08 #1
2 1376
ronverdonk
4,258 Expert 4TB
Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
Apr 9 '08 #2
I am writing a dynamic query
Expand|Select|Wrap|Line Numbers
  1. insert into Tablename select '1111',
  2. name,address,phone,'1111', exec usp_storedProcedureName '1111', '1111', 'KA','EA'
  3. from edi856Item
  4. where autoid = '1111'
I dont know why I am getting this error i think there is some syntax error:

Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'exec'.
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'from'.

Can anyone help please
Hi,

Try with the following insert statement, in ur insert statement one comma(,) is missing....
Expand|Select|Wrap|Line Numbers
  1.  
  2.       INSERT INTO Tablename SELECT '1111',
  3.         name,address,phone,'1111','exec usp_storedProcedureName', '1111', '1111', 'KA','EA'   FROM edi856Item
  4.          WHERE autoid = '1111'
Regards,
S.Ashokkumar
Apr 9 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Steve | last post: by
1 post views Thread by Donald Canton | last post: by
3 posts views Thread by Manuel | last post: by
1 post views Thread by Hari Sekhon | last post: by
7 posts views Thread by Josh | last post: by
Banfa
5 posts views Thread by Banfa | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.