Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Any SQL Server T-SQL Experts?



I know this is a long shot, but are there any T-SQL experts on the list?  I
need a query that will give me date/time in the format like this

YYYYMMDDHHmm (year, month, day, hour, minute) all with prepended zero's if
necessary.  So if the month is 02, it should appear as 02 not 2.

For example: 201002111411

The closest I've been able to come is the following, but it also gives me
seconds which I don't want.

SELECT replace(convert(varchar, getdate(),111),?/?,?) +

replace(convert(varchar, getdate(),108),?:?,?)

Also, if there's a better way than using replace, I'm good with that too.

-matt





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org