I am going through the book “Beginning SQL Server 2008” and the first instruction they have me doing doesn’t work. I am trying to execute the following after creating the database BankOfFees.
“I have tried and tried to post the example script here but this forum won’t let me”
I’ve copied this exactly as illustrated from the book. When I execute I get a syntax error; Incorrect syntax near the keyword ‘VALUES’
There is a red line under neath “VALUES” on the line with “Charles Dickenson”. When I hover the mouse over it I get “Incorrect Syntax near ‘VALUES’. Expecting ‘(‘.
Can anyone tell me what this means or where its going wrong. I don’t understand why this simple script would be wrong in the book and doesn’t work for me. The only small issue is that the book is “Beginning SQL Server 2008” and I am using SQL Server 2008 R2 as that is the closest version to the book I have access to.
Can you attach the SQL script as a text file, or post a screen shot of the script?
From the description, you are missing a bracket – the basic syntax is
INSERT INTO tablename (list of field names) VALUES ( list of values)
Note the brackets around the comma separated lists
ALso note SQL expects single quotes around text strings,not double quotes