-1

I need to insert a value to table column and the string contains ' ' ' in it. For eg. Al'aK and how to do this in sql server 2008 r2?

All that for doing it from asp.net and I am trying to do it sql itself.

Insert into @table values('Al'ak',1)

Sivajith
  • 1,181
  • 5
  • 19
  • 38
  • 2
    This is a very basic question and you can easily find this on Google. –  Mar 17 '15 at 21:03
  • Look up how to escape a single quote, and you will learn that you should use two single quotes instead of one – Jen R Mar 17 '15 at 21:03
  • possible duplicate of [How to write SQL statement with quotes?](http://stackoverflow.com/questions/9673427/how-to-write-sql-statement-with-quotes) –  Mar 17 '15 at 21:05
  • Its in the front end and I am searching for back end itself as part of a procedure – Sivajith Mar 17 '15 at 21:09

1 Answers1

0

Replace your ' with '' and insert

create table #tab(id int,value varchar(50))

insert into #tab values(1,'Alka''s')
select * from #tab
Krish KvR
  • 1,034
  • 4
  • 11
  • 18