I have a user defined function in datebase SQL 2000.
function looks like
create function Getcurrentdate
(@.month int, @.day int) returns smalldatetime
begin
declare date1 as smalldatetime
--get current year
--convert month, day and year into current date. then return
return date1
end
my problem was , after using getDate(). I get error meassage which is "can'not use getDate() inside user function"
How can I get current year in the user defined function. Thanks
|||
Hi
Here is another option a UDF doing time interval in SQL Server, I am assuming you know SmallDateTime will not give you seconds because of limited resolution. Hope this helps.
http://www.novicksoftware.com/UDFofWeek/Vol1/T-SQL-UDF-Volume-1-Number-38-udf_DT_AddTime.htm
|||Thanks, you guys. it's helpful
No comments:
Post a Comment