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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need 2 digit Month returned; not 1 digit!! 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
(Xcata thankyou for the previous solution!!)

How can I return a 2 digit month into a variable for the months Jan thru September

SELECT DATEPART(mm, GETDATE()) ---> returns 9 for September.. I need 09 returned in order to properly build my target file name...

Thx,
BT
 
try this

select substring(convert(varchar(10),getdate(),102),6,2)

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top