Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating date field 1

Status
Not open for further replies.

jbphoenix

Technical User
Apr 19, 2007
3
US
How would I combine these to make my date field look like this 20090531

select year(dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate() )+1,0)))

select month(dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate() )+1,0)))

select day(dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate() )+1,0)))
 
Select DateAdd(Month, 1 + DateDiff(Month, 0, GetDate()), -1)

If you don't want this as a date...

Select Convert(VarChar(8), DateAdd(Month, 1 + DateDiff(Month, 0, GetDate()), -1), 112)



-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top