Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 debug a function

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2007-05-04 : 15:58:41
Can someone help me debug the function below?

create Function [dbo].[fnNo1900](
@date datetime
)
returns datetime
begin
declare @newdate datetime
set @newdate =
case
when @date = '01/01/1900'
then @newdate = '01/01/2999'
else @newdate = @date
end
return @newdate
end

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-05-04 : 16:02:01
Sure, but what is the problem? What exactly do you want us to debug? What are you expecting?

Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

sshelper
Posting Yak Master

216 Posts

Posted - 2007-05-04 : 16:02:49
Try this updated query:

set @newdate =
case
when @date = '01/01/1900'
then '01/01/2999'
else @date
end

SQL Server Helper
http://www.sql-server-helper.com
Go to Top of Page

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2007-05-04 : 16:05:16
Thank you.
I try again, it works as sshelper.
Go to Top of Page
   

- Advertisement -