SQL Date Format

I need to store GetDate() as '19000101213924'  As [nvarchar](50)

                                              YYYYMMDDHHMMSS
LVL 3
MBoyAsked:
Who is Participating?
 
Aneesh RetnakaranDatabase AdministratorCommented:
select CONVERT(varchar, getdate(), 112 ) + REPLACE(CONVERT(varchar, getdate(),108),':','')
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
not sure what exactl the logic behind that, to be frnak thats not a good idea, why dont you store it as datetime
0
 
SharathData EngineerCommented:
check this.

SELECT replace(replace(replace(CONVERT(varchar(50),GETDATE(),120),':',''),'-',''),' ','')
0
 
MBoyAuthor Commented:
why dont you store it as datetime - I agree but the communications check routines dictate

Thanks for your help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.