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.
| Author |
Topic |
|
SCHEMA
Posting Yak Master
192 Posts |
Posted - 2009-08-09 : 08:54:43
|
| Now I have Backup as DBNAME_20090808.bak. It is transaction log backup. How do i get time as well like:DBNAME_200908081000.bak for 10 A.M backup and DBNAME_200908082300.bak for 11 P.M Backup.Currently I am using Variable as @V = Convert(varchar,getdate(),112) |
|
|
SCHEMA
Posting Yak Master
192 Posts |
Posted - 2009-08-09 : 09:03:03
|
| Any help? |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-08-09 : 09:31:16
|
select convert(varchar(4),year(getdate()))+right('00'+convert(varchar(2),month(getdate())),2)+right('00'+convert(varchar(2),day(getdate())),2)+right('00'+convert(varchar(2),datepart(hh,getdate())),2)+right('00'+convert(varchar(2),datepart(mi,getdate())),2) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
SCHEMA
Posting Yak Master
192 Posts |
Posted - 2009-08-09 : 09:33:39
|
| Thanks Webfred.Can't it be more simpler? |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-08-09 : 09:34:56
|
select Convert(varchar,getdate(),112)+right('00'+convert(varchar(2),datepart(hh,getdate())),2)+right('00'+convert(varchar(2),datepart(mi,getdate())),2) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
SCHEMA
Posting Yak Master
192 Posts |
Posted - 2009-08-09 : 09:37:13
|
| Yep thanks. That is what I came up with actually after reviewing yours. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-08-09 : 09:38:10
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-10 : 03:02:30
|
| orselect convert(varchar(10),getdate(),112)+replace(convert(varchar(10),getdate(),108),':','')MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|