Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Insert Into ...

Author  Topic 

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2006-05-02 : 00:30:15
Hi,

I have a string like "D'Souza" and wants to insert in a given format. Before inserting it, I replaces "'" with "", but now I want to insert as it is. What datatype should be use to insert this string in such manner?

Thanks in advance

BMahesh

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-05-02 : 00:37:09
you can use char or varchar. Just specify the single quote twice

create table #temp
(
yourcol varchar(100)
)
insert into #temp select 'D''Souza'
select * from #temp



KH

Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2006-05-02 : 01:11:52
thnx a lot dear

BMahesh
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-02 : 01:33:09
or

insert into #temp select 'D'+char(39)+'Souza'



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2006-05-02 : 02:21:39
thanx madhivanan
its also working

BMahesh
Go to Top of Page
   

- Advertisement -