Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CCYYMMDDHHMMSSHH Format?

Author  Topic 

TechAbhi
Starting Member

8 Posts

Posted - 2010-08-17 : 17:58:35
How do i get this format in sql server 2005
CCYYMMDDHHMMSSHH ?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-08-17 : 18:18:00
Formatting like that should be done inside your application and not inside SQL. You can play around with the various SQL functions though such as CONVERT (with as close to the style as you can get) and the date/time functions.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-08-18 : 09:27:14
But if dont have an option of a front end, you can try something like this in SQL Server...
select replace(replace(replace(convert(varchar(20),getdate(),120),':',''),' ',''),'-','')
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-08-18 : 11:17:18
As said, if there is no option, another method

select convert(char(8),getdate(),112)+replace(convert(char(12),getdate(),108),':','')


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -