I am using SQL Server Management Studio 2008 and writing the following query
INSERT INTO Transaction (TransactionType, AccountID, HolderName, Amount, CurrDate)
VALUES ('Cash Withdrawal', '25', 'abc', '1000', 'abc');
and the script for table is
SELECT TOP 1000 [ID]
,[TransactionType]
,[AccountID]
,[HolderName]
,[Amount]
,[CurrDate]
FROM [ATMSoftware].[dbo].[Transaction]
and ID
is the primary key and auto incremented. But I am getting the error on the insert query
Incorrect syntax near the keyword 'Transaction'.
Please help me
Regards
Transaction
is a reserved word. Put it in brackets.When in doubt, put object names in brackets.
you need to enclosed your tablename which is Transaction with [ and ]. Transaction is a reserved word.
This will surely work for you...Because Transaction is a
KeyWord
in sql management. i also had similar problem once and[]
helped me to come out of it.Vote up or accept if it works for you..
Transaction
is a reserved keyword in SQL Server. You need to enclose the table name in[]
to tell SQL Server it is a name and not a keyword: