Advertisement
Ghostyyy

asgag

Feb 6th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. /**************************************************/
  2. PRINT 'dbo.Server - PK';
  3. /**************************************************/
  4. SET ANSI_NULLS ON;
  5. SET NOCOUNT ON;
  6. SET QUOTED_IDENTIFIER OFF;
  7. SET XACT_ABORT ON;
  8.  
  9. /**************************************************
  10. Delete PK
  11. **************************************************/
  12. IF OBJECT_ID('dbo.Server_PK') IS NOT NULL
  13. BEGIN
  14. /**************************************************/
  15. PRINT CHAR(9) + 'dropping FKs';
  16. /**************************************************/
  17. EXEC sp_dba_Table_DropPK
  18. @aSPMode = 1
  19. , @aTableName = 'dbo.Server'
  20. ;
  21. /**************************************************/
  22. PRINT CHAR(9) + 'dropping PK';
  23. /**************************************************/
  24. ALTER TABLE dbo.Server DROP CONSTRAINT Server_PK;
  25. END
  26.  
  27. /**************************************************/
  28. PRINT CHAR(9) + 'Creating PK';
  29. /**************************************************/
  30. GO
  31.  
  32. ALTER TABLE dbo.Server ADD
  33. CONSTRAINT Server_PK PRIMARY KEY CLUSTERED
  34. (
  35. ServerID
  36. )
  37. ;
  38.  
  39. GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement