dbTalk Databases Forums  

SQL equivalent of "DateSerial" function in Access

microsoft.public.sqlserver.mseq microsoft.public.sqlserver.mseq


Discuss SQL equivalent of "DateSerial" function in Access in the microsoft.public.sqlserver.mseq forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dan S.
 
Posts: n/a

Default SQL equivalent of "DateSerial" function in Access - 07-24-2003 , 03:11 PM






I've gotten it now. Thanks.

Dan.


Quote:
-----Original Message-----
Below is a line from a select query I'm running where I'm
trying to select the 4th of the following month as a
field.

SELECT (CASE WHEN Month(GetDate())<>12 THEN (Year(GetDate
()) Month(GetDate()+1) Day(4)) ELSE (Year(GetDate()+1)
Month(1) Day(4)) END) AS NextPlacementDate


As you see, I'm using the CASE WHEN function to handle
the
situation correctly to get it to roll over to the next
year in December. However, I don't know how to combine
each part of the date (year, month, day) to create an
actual date listed as "NextPlacementDate". In Access, you
can use "DateSerial(year,month,day)" to combine the
numbers from each part and get a date, but I've noticed
in
SQL that DateSerial doesnt' seem to work. I've tried
different ways of combining these numbers, but have had
no
luck so far.

Any help will be greatly appreciated.

Thanks,

Dan.
.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.