Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    83

    Unhappy Unanswered: Case sensitive search

    I use to apply varbinary clause to go for a case sensitive search.Suppose for the case
    use pubs
    SELECT * FROM EMPLOYEE WHERE
    convert(varbinary,LNAME)=convert(varbinary,'Chang' )

    I am getting the correct result in every way.

    But when I apply the same rule in the following way
    use northwind
    SELECT * FROM employees WHERE
    convert(varbinary,lastname)=convert(varbinary,'Kin g')

    I am not getting any result wheather I pass the correct case sensetive parameter or not.

    Can anybody help me why there is a difference in these two results?
    One thing I like to mention in the first case the data type is varchar and in the latter case the datatype is nvarchar.Is this not applicable to the fields of type nvarchar.


    Subhasish

  2. #2
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393

    Re: Case sensitive search

    maybe there's some blanks after LastName :
    convert(varbinary,Rtim(LastName))=...

  3. #3
    Join Date
    Oct 2001
    Location
    England
    Posts
    426
    Indeed nvarchar is the problem

    convert(varbinary,lastname)=convert(varbinary,N'Ki ng')

    try
    SELECT lastname, convert(varbinary,lastname), convert(varbinary,'King')
    FROM employees

  4. #4
    Join Date
    Nov 2003
    Location
    FRANCE
    Posts
    393

    Re: Case sensitive search

    this will work for you :

    Select * From employees
    where
    convert(varbinary,convert(varchar,lastname))=
    convert(varbinary,'Buchanan')


    converting the nvarchar in varchar and then into a varbinary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •