question

shamim007 avatar image
shamim007 asked

MAX(backup_finish_date), 120

HI experts , I need to subtract a little time from like subtract 5 minutes DECLARE @cutoff NVARCHAR(50) = (SELECT CONVERT(NVARCHAR(25), MAX(backup_finish_date), 120) FROM msdb.dbo.backupset WHERE database_name = 'NetDB' AND [type] = 'D') i tried to MAX(backup_finish_date), 115? how do i do that ?
sql-server-2008-r2datetime
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
JohnM avatar image
JohnM answered
You can use DATEADD. (SELECT CONVERT(NVARCHAR(25), DATEADD(MINUTE,-5,MAX(backup_finish_date)), 120) AS 'Adjusted' ,CONVERT(NVARCHAR(25), MAX(backup_finish_date), 120) AS 'NonAdjusted' FROM msdb.dbo.backupset WHERE database_name = 'Administrator' AND [type] = 'D') Hope that helps!
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

thank you so much for your help .is it possible to do it for 1 column ?@JohnM
0 Likes 0 ·
What do you mean for 1 column?
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.