Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Access Adp SQL server > [newbie] functi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 4153 of 4388
Post > Topic >>

[newbie] function question

by Riyaz Mansoor <riyaz.mansoor@[EMAIL PROTECTED] > Jun 3, 2008 at 02:44 AM

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
 




 3 Posts in Topic:
[newbie] function question
Riyaz Mansoor <riyaz.m  2008-06-03 02:44:47 
RE: [newbie] function question
=?Utf-8?B?V29sZmdhbmcgTcO  2008-06-03 06:30:00 
Re: [newbie] function question
"Sylvain Lafontaine&  2008-06-08 14:59:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 23:58:35 CST 2008.