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 |
maggie21620
Starting Member
27 Posts |
Posted - 2013-10-16 : 16:24:05
|
i have a qry that brings back a delete date of the previous day when something was scheduled for deletion and I want to be able to see if the deletion actuall occurred and what the current status of the item is. I have this and it works fine to show me the status of F for deleted but i want to add another field to tell me if it actually was deleted. is that possible to do keeping in mind that our data is one day behind. In short how can i see the status for the box numbers that were set up to delete the day beforeSELECT DISTINCT [ACCTCORP] ,[BNUMB] ,[PREVHOUSE] ,[BXSTATUS] --,[FMT] --,[PROM] ,[HUB] ,[DELDATE] ,[OPR] ,[MODEL] ,[MACADDRESS] ,[EQUIP_VERSION] ,[SUBSCRIBEROWNED_FLG] ,[ADDRESS_TYPE] --,[LAST_UPDATE_DATE] FROM [infoDDP].[dbo].[IDST_BOX_INVENTORY] WHERE DELDATE BETWEEN CONVERT(VARCHAR(10), GETDATE() - 1, 101) AND DATEADD(d, -1, (DATEADD(hh, 23, (DATEADD(mi, 59, (DATEADD(ss, 59, (DATEADD(ms, 997, CONVERT(VARCHAR(10), GETDATE(), 101)))))))))) AND BXSTATUS <> ('D') AND SUBSCRIBEROWNED_FLG = '1'none |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2013-10-16 : 17:14:26
|
Not sure what the rules are for that - Is it as simple as this?select [BXSTATUS] , [BNUMB] from [infoDDP].[dbo].[IDST_BOX_INVENTORY]where [DELDATE] >= dateadd(day, datediff(day, 1, getdate()), 0) --yesterday 12:00 AMand [DELDATE] < dateadd(day, datediff(day, 0, getdate()), 0) --today 12:00 AM Be One with the OptimizerTG |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|
|