Incorrect Syntax Near the Keyword 'User'

SQL error: Incorrect syntax near the keyword 'User'

User is a reserved keyword, so you must use square brackets to make it explicit that you mean the object named "User" it, i.e. use [User] instead of User.

SQL Error: Incorrect Syntax near the keyword User

Why are you using double quotes at all? I would start with:

SELECT u.Disabled, u.UserName
FROM Database.dbo.User u
ORDER BY u.UserName ASC

You don't specify your database, but words like User are often reserved words, so they make a poor choice for an identifier name.

Incorrect syntax near the keyword 'User'. error on SQL Server

User is a reserved word and needs to be escaped, commonly by using square brackets e.g.

SELECT * FROM dbo.[User]

But double quotes also work:

SELECT * FROM dbo."User"

Although it will make your life (and any developers who follow) a lot easier if you just avoid using reserved words.

c# incorrect syntax near the keyword 'user'

user is a reserve word and thus needs escaping like insert into [user] values... Or insert into "user" values...

Incorrect syntax near the keyword 'user'- How to write my query - VB.net and Sql Server

Try this

     SELECT NAME, EMAIL, PASSWORD FROM [USER] 
WHERE ID =(SELECT USERID FROM EMPLOYERUSER WHERE EMPUSERTYPE=1 AND EMPLOYERID= 96)

This is because you have used keyword USER



Related Topics



Leave a reply



Submit