Click here to Skip to main content
15,942,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
suppose i have entered

This is Description. Assessment's. in text area control of

& then uses below query

insert into demo values('This is Description. Assessment's. ')

It gives error incorrect syntax near s. How should i deal with apostrophe s .

Assessment's This cause the error while inserting into tabel

Could you please suggest me


Exactly how you deal with this depends on exactly what you are doing: if you are entering this directly via SQL Sever Management Studio then just double up the quotes:
INSERT INTO demo VALUES('This is Description. Assessment''s. ')
(You should list the field names you are trying to insert into though - it can help prevent errors later)

However, if you are doing this via code from VB or C# for example, then you really should use a parameterized query to do the insert, and it will sort it out for you. (Concatenating strings to form an SQL query is very dangerous - it leaves you wide open to an SQL Injection Attack, which could damage or destroy your database).
Share this answer
Use Double apostrophe:-
insert into demo values('This is Description. Assessment''s. ')
Share this answer
U can utry this:-

DECLARE @val varchar(100)
SET @val='This is Description. Assessment''s.'
INSERT into demo(column_name)

Hope, this will help you...
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900