Single Apostrophe in Sql server
If you are using SQL strings in your database , chances are you have come across problem with strings in SQL statement. One extra apostrophe screws up the SQL string, causing the SQL statement to fail.if you insert the following query it throws the error like below
insert into emp values('gurucoder's')
Error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 's'.
Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark after the character string ')
'.
After some googled i found the solution to solve this .putting the double apostrophe in string value
insert into emp values('gurucoder''s')
The above query with double apostrophe will insert the values like gurucoder's in database field
0 comments :
Post a Comment