Syntax error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sva0008
    New Member
    • Apr 2008
    • 19

    Syntax error

    I am writing a dynamic query
    [code=mysql]
    insert into Tablename select '1111',
    name,address,ph one,'1111', exec usp_storedProce dureName '1111', '1111', 'KA','EA'
    from edi856Item
    where autoid = '1111'[/code]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
    Last edited by ronverdonk; Apr 9 '08, 10:47 AM. Reason: code tags!!
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    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

    Comment

    • ashokkumarpdi
      New Member
      • Apr 2008
      • 2

      #3
      Originally posted by sva0008
      I am writing a dynamic query
      [code=mysql]
      insert into Tablename select '1111',
      name,address,ph one,'1111', exec usp_storedProce dureName '1111', '1111', 'KA','EA'
      from edi856Item
      where autoid = '1111'[/code]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.... [code=mysql]

      INSERT INTO Tablename SELECT '1111',
      name,address,ph one,'1111','exe c usp_storedProce dureName', '1111', '1111', 'KA','EA' FROM edi856Item
      WHERE autoid = '1111'[/code]Regards,
      S.Ashokkumar
      Last edited by ronverdonk; Apr 9 '08, 01:14 PM. Reason: code tags!!

      Comment

      Working...