March 23, 2009 at 4:25 pm
SOrry but this post wasn't supposed to be included in the forum. Apparently while 'previewing' I must have hit 'Post' and not relaized it and for whatever reason I can't get the 'DELETE' to work on my posts.
Apolagies
Kindest Regards,
Just say No to Facebook!March 23, 2009 at 4:37 pm
[font="Verdana"]Okay, some thoughts:
The first is, do you really need to be formatting dates at the SQL Server level? A lot of the time, this is best left to the application or reporting tool. Just store dates as dates in SQL Server, and don't worry about formatting there if you can avoid it at all.
In the cases where you can't avoid it, have you considered creating a Calendar table? This can contain all of those nasties like Julianised dates, financial periods, various date formats and so on. You can set them up the once, and know that you will always get them right. Also, it encourages using sets of data.
[/font]
March 23, 2009 at 4:41 pm
Why not at least produce the year and month in a sortable form?
select YearMonth = convert(varchar(7),getdate(),121)
Results:
[font="Courier New"]YearMonth
---------
2009-03[/font]
I have links to a lot of info about working with Date/Time here, so if anyone is interested...
Date/Time Info and Script Links
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply