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
> execute issameday getdate, getdate
error -> Error converting data type nvarchar to datetime.
Works for
> execute issameday '08/08/08', '08/08/08'
I don't understand what is going on :( help please
create function IsSameDay (
@[EMAIL PROTECTED]
datetime,
@[EMAIL PROTECTED]
datetime = getdate
)
returns bit
as
begin
declare @[EMAIL PROTECTED]
int
set @[EMAIL PROTECTED]
= datediff(day, @[EMAIL PROTECTED]
@[EMAIL PROTECTED]
)
if @[EMAIL PROTECTED]
= 0 return 1
return 0
end
go