I have a DateTime column row and I declare a date string:
Row:
2010-08-27 13:45:55
My string:
'2010-08-27'
How can I check if that string is in that row ?
I tried the following query:
declare @year as nvarchar(4)
declare @month as nvarchar(2)
declare @day as nvarchar(2)
set @year = '2010'
set @month = '08'
set @day = '23'
select * FROM [dbo].[customer_import] CsrImport
where
(YEAR(CsrImport.import_date) = @year
AND MONTH(CsrImport.import_date) = @month
AND DAY(CsrImport.import_date) = @day)
but I see that it returns all rows (even that are not contains that date)
Sql server : ISDATE (Transact-SQL)