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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 getdate() function

Author  Topic 

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 2007-06-20 : 14:09:19
Guys,

I want build a number out of getdate() function

For example.

getdate() result
____________________________________________
2007-06-20 14:04:35.483 200706201404

I tried to use subtring function, but substring doesnt seem to take datetime datatype as input.

Any suggestions/inputs would help.

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-06-20 : 14:29:38
select current_timestamp,
convert(varchar, current_timestamp, 112) + replace(convert(varchar(5), current_timestamp, 108), ':', '')

Peter Larsson
Helsingborg, Sweden
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-20 : 23:58:25
Also, if you use front end application, try using the format YYYYMMDDHHMM and see if that works

Madhivanan

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

- Advertisement -