R
Riyaz Mansoor
SQL Server 2005. The function below compiles fine. If the two dates
are same return 1 (true) else false.
But the testing gives an type error
Works for
I don't understand what is going on help please
create function IsSameDay (
@sampledate datetime,
@checkdate datetime = getdate
)
returns bit
as
begin
declare @days int
set @days = datediff(day, @sampledate, @checkdate)
if @days = 0 return 1
return 0
end
go
are same return 1 (true) else false.
But the testing gives an type error
error -> Error converting data type nvarchar to datetime.execute issameday getdate, getdate
Works for
execute issameday '08/08/08', '08/08/08'
I don't understand what is going on help please
create function IsSameDay (
@sampledate datetime,
@checkdate datetime = getdate
)
returns bit
as
begin
declare @days int
set @days = datediff(day, @sampledate, @checkdate)
if @days = 0 return 1
return 0
end
go