Hi,
I tried to use GetDate inside a SQL server 2000 user defined function and
got error:
Invalid use of GetDate within a function
Here is my code snippet:
DECLARE @.Today smallDateTime
SET @.Today = GetDate()
What should I do?
TIAGETDATE() is nondeterinistic and, thus, cannot be used in a function. You
can, however, create a view and use it:
create view Now
as
select getdate () RightNow
go
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
"John" <someone@.microsoft.com> wrote in message
news:e6ZConVHGHA.532@.TK2MSFTNGP15.phx.gbl...
Hi,
I tried to use GetDate inside a SQL server 2000 user defined function and
got error:
Invalid use of GetDate within a function
Here is my code snippet:
DECLARE @.Today smallDateTime
SET @.Today = GetDate()
What should I do?
TIA|||do this
declare @.date datetime
select @.date =max(last_XXXXX) from master.dbo.sysprocesses
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"John" <someone@.microsoft.com> wrote in message
news:e6ZConVHGHA.532@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I tried to use GetDate inside a SQL server 2000 user defined function and
> got error:
> Invalid use of GetDate within a function
> Here is my code snippet:
> DECLARE @.Today smallDateTime
> SET @.Today = GetDate()
> What should I do?
> TIA
>|||oops sorry, nasty typo there
declare @.date datetime
select @.date =max(last_bAtch) from sysprocesses
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"John" <someone@.microsoft.com> wrote in message
news:e6ZConVHGHA.532@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I tried to use GetDate inside a SQL server 2000 user defined function and
> got error:
> Invalid use of GetDate within a function
> Here is my code snippet:
> DECLARE @.Today smallDateTime
> SET @.Today = GetDate()
> What should I do?
> TIA
>|||I was wondering if maybe the developer was having a bad day with the
wife/mother-in-law when he designed the Last_XXXXX column <grin>
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:uPsQ4jWHGHA.3728@.tk2msftngp13.phx.gbl...
> oops sorry, nasty typo there
>
> declare @.date datetime
> select @.date =max(last_bAtch) from sysprocesses
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
> "John" <someone@.microsoft.com> wrote in message
> news:e6ZConVHGHA.532@.TK2MSFTNGP15.phx.gbl...
>|||ROFL!
I must admit, it was the very first thing that caught my eye when I
glanced at Hilary's code snippet. Great Freudian slip there Hilary!
*mike hodgson*
http://sqlnerd.blogspot.com
Dave Frommer wrote:
>I was wondering if maybe the developer was having a bad day with the
>wife/mother-in-law when he designed the Last_XXXXX column <grin>
>"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
>news:uPsQ4jWHGHA.3728@.tk2msftngp13.phx.gbl...
>
>
>|||Thanks for pointing that out. Needed a good laugh in the morning. :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Dave Frommer" <anti@.spam.com> wrote in message news:eQaWLxWHGHA.1028@.TK2MSFTNGP11.phx.gbl.
.
>I was wondering if maybe the developer was having a bad day with the
> wife/mother-in-law when he designed the Last_XXXXX column <grin>
>|||:-))))))))))))))))
"Dave Frommer" <anti@.spam.com> wrote in message
news:eQaWLxWHGHA.1028@.TK2MSFTNGP11.phx.gbl...
>I was wondering if maybe the developer was having a bad day with the
>wife/mother-in-law when he designed the Last_XXXXX column <grin>
> "Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
> news:uPsQ4jWHGHA.3728@.tk2msftngp13.phx.gbl...
>|||last_XXXXX? Must be a dog show database. :)
ML
http://milambda.blogspot.com/|||The mask has slipped... ;-)
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinpub.com
.
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:uPsQ4jWHGHA.3728@.tk2msftngp13.phx.gbl...
oops sorry, nasty typo there
declare @.date datetime
select @.date =max(last_bAtch) from sysprocesses
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"John" <someone@.microsoft.com> wrote in message
news:e6ZConVHGHA.532@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I tried to use GetDate inside a SQL server 2000 user defined function and
> got error:
> Invalid use of GetDate within a function
> Here is my code snippet:
> DECLARE @.Today smallDateTime
> SET @.Today = GetDate()
> What should I do?
> TIA
>
No comments:
Post a Comment