Text search from database
-
i am using Visual Studio 2005 and Sql Server 2000. pl could u tell me how to Search database elements from the given textbox fields so that the comparison is independent of Case senstivity.. hope i made myself clear.. thanx
Select something from sometable where somefield like '%somevalue%'
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
i am using Visual Studio 2005 and Sql Server 2000. pl could u tell me how to Search database elements from the given textbox fields so that the comparison is independent of Case senstivity.. hope i made myself clear.. thanx
hey manas.. i dint get u.. i mean to say that in a textbox the value inputed has to be compared with that from database table.and i want that the search must be independent of capitalization of the textbox value. example. if table has "Sunday" then the textbox value "SuNdAy" must also match wid it.. pl explian it in detail,m a bit new to it.. thanx
-
hey manas.. i dint get u.. i mean to say that in a textbox the value inputed has to be compared with that from database table.and i want that the search must be independent of capitalization of the textbox value. example. if table has "Sunday" then the textbox value "SuNdAy" must also match wid it.. pl explian it in detail,m a bit new to it.. thanx
as far as i know, SQL Server is not case sensitive for text comparision, so just compare like
select * from t where xyz = 'abc'
orselect * from t where xyz = 'ABC'
both are same. 'Sunday' and 'SUNDAY' are same in SQL Server. or if you want to make sure than you can use either UPPER() or LOWER() i.e.select * from t where upper(xyz) = 'ABC'
Also Manas is trying to tell you that if you want to do partial search then use 'Like' with '%' ex.select * from t where Day like 'S%'
will return both 'Saturday' and 'Sunday' whileselect * from t where Day like 'Su%';
will return only 'Sunday' in short % is like * in DOS.modified on Tuesday, September 9, 2008 12:48 PM