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 2008 Forums
 Transact-SQL (2008)
 Case sensitive repalce in sql server 2008

Author  Topic 

kamii47
Constraint Violating Yak Guru

353 Posts

Posted - 2011-12-28 : 11:25:08
I have field in which i wanated to replace case sentively


declare @segccategory varchar(20)
set @segccategory = 'afdfdfF'

select @segccategory = REPLACE(@segccategory, 'F', 'LTRS');

select @segccategory

Result should be 'afdfdfLTRS'

but currently it is showing 'aLTRSdLTRSdLTRSLTRS'


Kamran Shahid
Principle Engineer Development
(MCSD.Net,MCPD.net)

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-28 : 11:38:57
for that you need make column case sensitive. something like below


declare @segccategory varchar(20)
set @segccategory = 'afdfdfF'

select @segccategory = REPLACE(@segccategory collate SQL_Latin1_General_CP1_CS_AS, 'F', 'LTRS');

select @segccategory




------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

kamii47
Constraint Violating Yak Guru

353 Posts

Posted - 2011-12-28 : 12:10:40
Thanks

Kamran Shahid
Principle Engineer Development
(MCSD.Net,MCPD.net)

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-28 : 12:15:07
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-12-29 : 14:38:21
quote:
Originally posted by visakh16


... collate SQL_Latin1_General_CP1_CS_AS ...




Pro's and Con's of SQL_Latin1_General_CP1_CS_AS v. Latin1_General_BIN2 ??
Go to Top of Page
   

- Advertisement -