[SqlException: Line 1: Incorrect syntax near '.'.]

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roger R. Smith

    [SqlException: Line 1: Incorrect syntax near '.'.]

    I see this error in my ASP .NET code:

    [SqlException: Line 1: Incorrect syntax near '.'.]

    I am trying to execute the following:
    private const string SQL_SELECT_USER = "SELECT User.Email, User.FirstName,
    User.LastName, User.Status, User.Phone, User.Privs FROM User INNER JOIN
    Login ON User.UserId = Login.UserId WHERE Login.UserId = @UserId AND
    Login.Password = @Password";



    Any ideas here?

    Thanks

    Rog


  • Uwe Hafner

    #2
    Re: [SqlException: Line 1: Incorrect syntax near '.'.]

    "User" is a reserved keyword on SQLServer

    Use Brackets "[]" like [User] instead of User.

    hth
    Uwe


    "Roger R. Smith" <rogesmit@cisco .com> schrieb im Newsbeitrag
    news:1065678795 .255298@sj-nntpcache-3...[color=blue]
    > I see this error in my ASP .NET code:
    >
    > [SqlException: Line 1: Incorrect syntax near '.'.]
    >
    > I am trying to execute the following:
    > private const string SQL_SELECT_USER = "SELECT User.Email, User.FirstName,
    > User.LastName, User.Status, User.Phone, User.Privs FROM User INNER JOIN
    > Login ON User.UserId = Login.UserId WHERE Login.UserId = @UserId AND
    > Login.Password = @Password";
    >
    >
    >
    > Any ideas here?
    >
    > Thanks
    >
    > Rog
    >
    >[/color]


    Comment

    • Roger R. Smith

      #3
      Re: [SqlException: Line 1: Incorrect syntax near '.'.]

      Thank you very much Uwe. That was it!
      thank you for taking the time to help me.
      Rog


      "Uwe Hafner" <spamUrSelf@NOS PAM.de> wrote in message
      news:OBJQJEljDH A.2328@TK2MSFTN GP10.phx.gbl...[color=blue]
      > "User" is a reserved keyword on SQLServer
      >
      > Use Brackets "[]" like [User] instead of User.
      >
      > hth
      > Uwe
      >
      >
      > "Roger R. Smith" <rogesmit@cisco .com> schrieb im Newsbeitrag
      > news:1065678795 .255298@sj-nntpcache-3...[color=green]
      > > I see this error in my ASP .NET code:
      > >
      > > [SqlException: Line 1: Incorrect syntax near '.'.]
      > >
      > > I am trying to execute the following:
      > > private const string SQL_SELECT_USER = "SELECT User.Email,[/color][/color]
      User.FirstName,[color=blue][color=green]
      > > User.LastName, User.Status, User.Phone, User.Privs FROM User INNER JOIN
      > > Login ON User.UserId = Login.UserId WHERE Login.UserId = @UserId AND
      > > Login.Password = @Password";
      > >
      > >
      > >
      > > Any ideas here?
      > >
      > > Thanks
      > >
      > > Rog
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...