IT Community - Software Programming, Web Development and Technical Support

How to compare the string with case sensitive in sql server?

This is a discussion on How to compare the string with case sensitive in sql server? within the Database Support forums, part of the Web Development category; How to compare the string with case sensitive in sql server?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-26-2008, 04:19 AM
krishnakumar krishnakumar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 206
krishnakumar is on a distinguished road
Question How to compare the string with case sensitive in sql server?

How to compare the string with case sensitive in sql server?
__________________
Krishnakumar.S
Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-26-2008, 04:31 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Smile Re: How to compare the string with case sensitive in sql server?

Yes...for that you can use encrypt function.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-26-2008, 06:00 AM
krishnakumar krishnakumar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 206
krishnakumar is on a distinguished road
Exclamation Re: How to compare the string with case sensitive in sql server?

Hey buddy,

Can you show the code how to do that?
__________________
Krishnakumar.S
Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-27-2008, 02:45 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Cool Re: How to compare the string with case sensitive in sql server?

Yeah..sure...

Code:
declare @Test int
if((encrypt('test')=encrypt('Test'))) 
set @Test=1 
else if((encrypt('test')!=encrypt('Test')))
set @Test=0
select @Test as Result
That’s it…
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-28-2008, 04:08 AM
krishnakumar krishnakumar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 206
krishnakumar is on a distinguished road
Smile Re: How to compare the string with case sensitive in sql server?

hey buddy,

I tried your way. But there is no "encrypt" function.
__________________
Krishnakumar.S
Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-29-2008, 01:16 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Unhappy Re: How to compare the string with case sensitive in sql server?

Is it?

what version of sql server have you using?
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-31-2008, 04:09 AM
krishnakumar krishnakumar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 206
krishnakumar is on a distinguished road
Exclamation Re: How to compare the string with case sensitive in sql server?

am using Sql Server 2005.

__________________
Krishnakumar.S
Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-31-2008, 10:09 PM
krishnakumar krishnakumar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 206
krishnakumar is on a distinguished road
Talking Re: How to compare the string with case sensitive in sql server?

Oh mate!

I think this is available only in 2000
__________________
Krishnakumar.S
Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-02-2008, 04:56 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Wink Re: How to compare the string with case sensitive in sql server?

Yes mate...

this is only in 2000. I will try and let u know whether I came to know the solution.
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 10-10-2008, 04:54 AM
nefoea nefoea is offline
D-Web Trainee
 
Join Date: Oct 2008
Posts: 1
nefoea is on a distinguished road
Default Re: How to compare the string with case sensitive in sql server?

select case when (cast('UPPER' as varbinary(max)) = cast('upper' as varbinary(max))) then 'same' else 'different' end


OR

select case when 'UPPER' COLLATE Latin1_General_CS_AS = 'upper' THEN 'SAME' ELSE 'DIFFERENT' END
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare a string with String Array. oxygen C# Programming 5 12-28-2007 11:18 PM
What is diffrenece between string.compare and string.compareordinal shaalini ASP and ASP.NET Programming 3 12-28-2007 10:46 PM
Case sensitive comparison in mysql? velhari Database Support 1 12-04-2007 01:29 AM
XML case-sensitive vigneshgets C# Programming 2 07-12-2007 05:18 AM
Handle Case Sensitive Search in MySQL priyan Database Support 6 07-10-2007 07:21 AM


All times are GMT -7. The time now is 05:37 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0