locked
SQL receiving erros RRS feed

  • Question

  • I'm receiving an error that says

    Msg102, Level 15, State 1, Line 5

    Incorrect syntax near 'Last_name'

    How can I fix this?

    Sunday, September 5, 2010 10:25 PM

Answers

  • Syntax error...check Comma ( , ) /Operator, before/after "Last_name" in your query..

    thanks...


    - MS (We are what we repeatedly do, Excellence, then, is not an act, but a habit.)
    Monday, September 6, 2010 6:27 AM
  • You probably have

    CREATE

     

    TABLE #t(LastName VARCHAR(20),FirstName VARCHAR(20))

    SELECT

     

    FirstName;LastName FROM #t

    Incorrect syntax near 'LastName'.

    Change to

    SELECT

     

    FirstName,LastName FROM #t


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    Monday, September 6, 2010 7:16 AM

All replies

  • Hi


    Can you please post the code you are trying to execute - as the error message states, there is a syntax error that needs fixing...

    Monday, September 6, 2010 12:07 AM
  • Syntax error...check Comma ( , ) /Operator, before/after "Last_name" in your query..

    thanks...


    - MS (We are what we repeatedly do, Excellence, then, is not an act, but a habit.)
    Monday, September 6, 2010 6:27 AM
  • You probably have

    CREATE

     

    TABLE #t(LastName VARCHAR(20),FirstName VARCHAR(20))

    SELECT

     

    FirstName;LastName FROM #t

    Incorrect syntax near 'LastName'.

    Change to

    SELECT

     

    FirstName,LastName FROM #t


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    Monday, September 6, 2010 7:16 AM