March 25, 2008 at 4:57 am
Morning All
Id like to format a Date String to look like the following using T-SQL:
'Tue, 01 Jan 2002'
Could anyone give me a hand with the code im stuck?
Thanks, Scott
March 25, 2008 at 5:09 am
Scott Holmes (3/25/2008)
Morning AllId like to format a Date String to look like the following using T-SQL:
'Tue, 01 Jan 2002'
Could anyone give me a hand with the code im stuck?
Thanks, Scott
Hi Scott.
Try this:
SELECT
CASE DATEPART(weekday,GETDATE())
WHEN 1 THEN 'Sun'
WHEN 2 THEN 'Mon'
WHEN 3 THEN 'Tue'
WHEN 4 THEN 'Wed'
WHEN 5 THEN 'Thur'
WHEN 6 THEN 'Fri'
WHEN 7 THEN 'Sat'
END + ', ' + CONVERT(VARCHAR,GETDATE(),106)
Note that, by default, Sunday is the first day of the week but you can change this using the SET DATEFIRST option.
Hope that helps,
March 25, 2008 at 5:23 am
Excellent, works perfectly
Thank you very much.
April 25, 2008 at 8:41 pm
You don't need to worry about DateFirst with the following...
[font="Courier New"] SELECT LEFT(DATENAME(dw,GETDATE()),3)
+ ', ' + CONVERT(VARCHAR,GETDATE(),106)[/font]
--Jeff Moden
Change is inevitable... Change for the better is not.
May 6, 2008 at 1:03 am
Thanks Jeff, just got back after being on holiday for 2 weeks. I will try to remember what i was doing and see if your version works better for me
May 21, 2008 at 9:34 pm
So... did it?
--Jeff Moden
Change is inevitable... Change for the better is not.
May 22, 2008 at 1:12 am
Man, if i had a memory id be dangerous!
It did yes thanks, used it in a few other places as well!
May 22, 2008 at 6:45 pm
Heh... no problem... I didn't remember either... was reviewing old posts that I had flagged 'cause I knew I'd forget.
Thanks for the feedback!
--Jeff Moden
Change is inevitable... Change for the better is not.
May 22, 2008 at 7:49 pm
Flag a post? how?
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
May 22, 2008 at 10:48 pm
Sorry... didn't mean to get you excited.
"Flag" a post, in this case, meant that I save the URL for the post in my "Things to follow up on" list that I keep in a text file. There's not way to actually flag a post that I know of.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 23, 2008 at 1:05 am
You can subscribe to any Topic, and soon as a reply hits you get an email. Think thats the best you can do
May 23, 2008 at 1:39 am
Jeff Moden (5/22/2008)
Sorry... didn't mean to get you excited."Flag" a post, in this case, meant that I save the URL for the post in my "Things to follow up on" list that I keep in a text file. There's not way to actually flag a post that I know of.
Nearly missed this, you save it in a text file and NOT an Access Database, with forms, reports and reminders being sent....
The shame
May 23, 2008 at 8:54 am
Heh... nope... none of that... I don't even join it with a Tally Table to preserve the dates or anything... it just bubbled to the top on a simple text file being used as a "stack".
--Jeff Moden
Change is inevitable... Change for the better is not.
May 23, 2008 at 9:05 am
Jeff Moden (5/22/2008)
Sorry... didn't mean to get you excited."Flag" a post, in this case, meant that I save the URL for the post in my "Things to follow up on" list that I keep in a text file. There's not way to actually flag a post that I know of.
#$$%^&^&***(. Oh well... I was kind of hoping I had missed something obvious all this time.
I tend to access SSC from a few different machines, so unless I plan on carrying around that text file on a memory stick, ain't going to help much.
I suppose I should be more stringent about using the "subscribed topic" just for these...
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 14 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy