Friday, March 23, 2012

Query

Using sql 2000
Query
SELECT enddate,last_day(enddate
FROM Project;
Error
Server: Msg 195, Level 15, State 10, Line
'last_day' is not a recognized function nameWhat is last_day? Is enddate the column and you want the max value? If so,
SELECT max(enddate)
FROM Project
HTH
--
Ray Higdon MCSE, MCDBA, CCNA
--
"rmsands" <anonymous@.discussions.microsoft.com> wrote in message
news:43EAC36D-FC2A-4616-B2EE-2F9EE97E915A@.microsoft.com...
> Using sql 2000:
> Query:
> SELECT enddate,last_day(enddate)
> FROM Project;
> Error:
> Server: Msg 195, Level 15, State 10, Line 1
> 'last_day' is not a recognized function name.
>
>|||If your last_day is a user defined function you need to put the owner in
front of it
SELECT enddate,dbo.last_day(enddate)
FROM Project;
--
Dandy Weyn, Belgium
MCSE, MCSA, MCDBA, MCT
http://www.dandyman.net
Check my SQL Server resource pages (currently under construction)
http://www.dandyman.net/sql
"Ray Higdon" <sqlhigdon@.nospam.yahoo.com> wrote in message
news:uaj1z9X#DHA.3816@.tk2msftngp13.phx.gbl...
> What is last_day? Is enddate the column and you want the max value? If so,
> SELECT max(enddate)
> FROM Project
> HTH
> --
> Ray Higdon MCSE, MCDBA, CCNA
> --
> "rmsands" <anonymous@.discussions.microsoft.com> wrote in message
> news:43EAC36D-FC2A-4616-B2EE-2F9EE97E915A@.microsoft.com...
> > Using sql 2000:
> >
> > Query:
> >
> > SELECT enddate,last_day(enddate)
> > FROM Project;
> >
> > Error:
> >
> > Server: Msg 195, Level 15, State 10, Line 1
> > 'last_day' is not a recognized function name.
> >
> >
> >
>|||I WANT TO KNOW WHAT THE LAST DAY OF THE MONTH IS IN THE COLUMN ENDDATE.|||Date of the last day of the month of Enddate:
SELECT DATEADD(MONTH,1,DATEADD(DAY,-DAY(enddate),enddate))
FROM Project
Last day of the month of Enddate:
SELECT DAY(DATEADD(MONTH,1,DATEADD(DAY,-DAY(enddate),enddate)))
FROM Project
--
David Portas
SQL Server MVP
--

No comments:

Post a Comment