say, in my database there're two rows,
name age career
dave 20 student
Dave 20 student
if i use select * from db where name='dave'
both will come out, how to do a case-sensitive that i got only the 1st row ?
Change the collation of the name column to a case-sensetive collation such as SQL_Latin1_General_CP1_CS_AS|||yep, thx!
but what's the differents in the codepage?
|||I do think I understood your question, however you can pich the collation you want but be sure to check the Case sensetive checkbox.|||here is an example
create table #test (name varchar(50), age int, career varchar(50))
insert into #test values('dave',20,'student')
insert into #test values('Dave',20,'student')
select * from #test where name='dave'
select * from #test where name collate SQL_Latin1_General_CP1_CS_AS ='dave'
select * from #test where name collate SQL_Latin1_General_CP1_CS_AS ='Dave'
Denis the SQL Menace
http://sqlservercode.blogspot.com/
|||Hi,
for example look at the mentioned collation:
SQL_Latin1_General_CP1_CS_AS
SQL_Latin1_General_CP1 -Sql Server Code page (General)
CS - Case Sensitive
AS - Accent Sensitive
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
|||thx all you guys, i now how to use collation!
but, i still dont know what's the differents between CP1 and CP2
i am now using CP1, and it's working allright
Take a look at this
select * from ::fn_helpcollations()
where name like 'SQL_Latin1_General_CP%'
Denis the SQL Menace
http://sqlservercode.blogspot.com/
No comments:
Post a Comment