Created
August 28, 2011 01:45
-
-
Save keyvan/1176131 to your computer and use it in GitHub Desktop.
The SQL script to remove fake test items in NerdDinner database based on the keyword "test" and the date difference in future.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @CurrentDate datetime | |
SET @CurrentDate = getutcdate() | |
DECLARE @Days int | |
SET @Days = 180 | |
DELETE [NerdDinner].[dbo].[RSVP] | |
WHERE [DinnerID] in | |
(SELECT [DinnerID] | |
FROM [NerdDinner].[dbo].[Dinners] | |
WHERE | |
[Title] LIKE '%test%' | |
OR [Description] LIKE '%test%' | |
OR (DATEDIFF(DAY, @CurrentDate, [EventDate]) >= @Days) | |
) | |
DELETE [NerdDinner].[dbo].[Dinners] | |
WHERE | |
[Title] LIKE '%test%' | |
OR [Description] LIKE '%test%' | |
OR (DATEDIFF(DAY, @CurrentDate, [EventDate]) >= @Days) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment