Advertisement
GrayMP

simple seed

May 21st, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.63 KB | None | 0 0
  1. PRINT 'els_hazardCategories BEGIN'
  2.  
  3. -- important if seed crashed.
  4. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[sp_tmp_insert_Lookup]') AND TYPE IN (N'P', N'PC'))
  5.     DROP PROCEDURE sp_tmp_insert_Lookup
  6. GO
  7.  
  8. CREATE PROCEDURE sp_tmp_insert_Lookup (@Code nvarchar(64))
  9. AS
  10. BEGIN
  11.     IF NOT EXISTS (SELECT 1 FROM els_hazardCategories WHERE Code = @Code)
  12.         INSERT INTO els_hazardCategories(Code)  VALUES  (@Code)
  13. END
  14. GO
  15.  
  16. EXEC sp_tmp_insert_Lookup @Code = 'I'
  17. EXEC sp_tmp_insert_Lookup @Code = 'II'
  18. EXEC sp_tmp_insert_Lookup @Code = 'III'
  19.  
  20. DROP PROCEDURE sp_tmp_insert_Lookup
  21. GO
  22.  
  23. PRINT 'els_hazardCategories END'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement