SQL Server Performance

select clause

Discussion in 'SQL Server 2008 General DBA Questions' started by klehonia, Sep 7, 2010.

  1. klehonia New Member

    Hi everyone, i have a table with a column that is nvarchar and contains words and a date like dd/mm/yyyy. I try to run a select query with a where clause that search rows with the today date like this:
    select * from table
    where column like (select CONVERT(NVARCHAR(10),GETDATE(),103))
    but found nothing. The query is wrong or needs another command? There are rows with the today date nevertheless.
    thank you
  2. FrankKalis Moderator

    Your LIKE expression is only looking for an exact match on the date. Try adding wildcards like
    LIKE '%' + CONVERT(NVARCHAR(10),GETDATE(),103) + '%'
  3. klehonia New Member

    Thank you very much! It works of course.

Share This Page