Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.36 KB | None | 0 0
  1. IF OBJECT_ID(N'tempdb..#temp_ids', N'U') IS NOT NULL
  2. BEGIN
  3.     DROP TABLE #temp_ids
  4. END
  5. CREATE TABLE #temp_ids
  6. (
  7.     FileGuid uniqueidentifier,
  8. );
  9.  
  10. INSERT INTO #temp_ids(FileGuid) VALUES(@GUIDS)
  11.  
  12. DELETE FROM dbo.DocumentStore
  13. WHERE stream_id IN
  14. (   SELECT ds.stream_id
  15.     FROM dbo.DocumentStore ds
  16.     INNER JOIN
  17.     #temp_ids ti ON
  18.     ds.stream_id != ti.FileGuid)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement