Reputation: 283
I'm creating a simple table and i'm not able to use the reserved keyword Password. I tried using backticks, but get an error
"Msg 102, Level 15, State 1, Line 7 Incorrect syntax near '`'."
I don't wanna use double quotes, can someone please tell me how to get this backtick thing working.
CREATE TABLE Users (
NTID VARCHAR(20) PRIMARY KEY,
FirstName VARCHAR(50) NOT NULL,
MiddleI CHAR(1),
LastName VARCHAR(50) NOT NULL,
EmailAddress VARCHAR(100) UNIQUE,
`Password` VARCHAR(50)
);
Upvotes: 0
Views: 629
Reputation: 263723
reading your error message, it seems that you are using SQL Server, not MySQL.
You need to use []
to escape reserved keywords.
CREATE TABLE Users (
NTID VARCHAR(20) PRIMARY KEY,
FirstName VARCHAR(50) NOT NULL,
MiddleI CHAR(1),
LastName VARCHAR(50) NOT NULL,
EmailAddress VARCHAR(100) UNIQUE,
[Password] VARCHAR(50)
);
Upvotes: 6