Reputation: 486
EDIT: Thanks guys. It was truly just a formatting error of the single-quotation mark from the source code I copied. Thanks a lot!
Codes:
USE Library;
INSERT INTO myLibrary VALUES (
‘SQL Bible’
,‘Alex Kriegel’
,‘Boris M. Trukhnov’
,‘Wiley’
,888
,‘April 7,2008’
,‘978-0470229064’
,‘English’
);
Output:
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near '‘'.
Question
What is the problem here? I am new to SQL. Thanks in advance!
Upvotes: 0
Views: 63
Reputation: 2647
In SQL, strings are defined with the '
characters, not ‘
and ’
Upvotes: 2
Reputation: 1848
If you did a copy/paste from some software, like Word, it can have formatting attached. Your SQL engine will not interpret it.
Take the code, put it into notepad or some other simple text editor (notepad + or jedit are two that I use) and do a replace the open quote and the end quote with a ' or ".
Upvotes: 1
Reputation: 2400
Looks like you're using the wrong character to encapsulate your strings. Instead of the ‘
character, you need to use either a '
or a "
:
USE Library;
INSERT INTO myLibrary VALUES (
"SQL Bible"
,"Alex Kriegel"
,"Boris M. Trukhnov"
,"Wiley"
,888
,"April 7,2008"
,"978-0470229064"
,"English"
);
Upvotes: 1