User Funcrions / Current Date  
Author Message
Nuevo





PostPosted: Tue Jan 13 17:48:31 CST 2004 Top

SQL Server Developer >> User Funcrions / Current Date

How do you get the current date/time in a user defined function? It
appears that getdate() is not allowed.

Converting Oracle Databse to SQL Server database. I am new to SQL
SERVER.




*** Sent via Developersdex http://www.hide-link.com/ ***
Don't just participate in USENET...get rewarded for it!

SQL Server277  
 
 
Delbert





PostPosted: Tue Jan 13 17:48:31 CST 2004 Top

SQL Server Developer >> User Funcrions / Current Date Wrap getdate with a view. (see below)


create view GetDatePlease as select getdate() as HereYouAre
go

create function ThreeDaysFromNow()
returns datetime
as
begin
return(select dateadd(day,3,(select * from GetDatePlease)))
end
go

select dbo.ThreeDaysFromNow()

--drop function ThreeDaysFromNow
--drop view GetDatePlease

Bye,
Delbert Glass



>
> How do you get the current date/time in a user defined function? It
> appears that getdate() is not allowed.
>
> Converting Oracle Databse to SQL Server database. I am new to SQL
> SERVER.
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


 
 
SteveC





PostPosted: Tue Jan 13 19:13:31 CST 2004 Top

SQL Server Developer >> User Funcrions / Current Date
I will try this out.
Thanks,
SteveC


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!