hi, Im tryinf to fix in to the function date different. One of the date is i
n
the declared variability and the other is current day
why
select datediff(hh,@.datetime,getdate())
doesnt work in the function?
It responds : INVALID USE OF GETDATE WITHIN A FUNCTION
Thanks in advanceThats one of the limitations in functions, you can=B4t use getdate(). A
common solution is to pass the current date as a paramter to the
function.
HTH, Jens Suessmeyer.|||Please, can you give a short example?
Jens p_?e:
> Thats one of the limitations in functions, you can′t use getdate(). A
> common solution is to pass the current date as a paramter to the
> function.
> HTH, Jens Suessmeyer.
>|||Define an extra in parameter for your function, and pass if the current date
time in that parameter
when you call the function.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"pietro" <pietro@.discussions.microsoft.com> wrote in message
news:66C97A6C-932A-43C7-AB67-C816DB330C5A@.microsoft.com...
> Please, can you give a short example?
>
> Jens p_?e:
>|||Sure:
CREATE FUNCTION SomeFunction
(
@.SomeDateparam DATETIME
)
(...)
Call: SELECT dbo.SomeFunction(GETDATE())
HTH, Jens Suessmeyer.
No comments:
Post a Comment