Skip to content

Instantly share code, notes, and snippets.

@ksakae1216
Created May 17, 2017 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksakae1216/1b7f1de46df8376bd51a96c9171d696e to your computer and use it in GitHub Desktop.
Save ksakae1216/1b7f1de46df8376bd51a96c9171d696e to your computer and use it in GitHub Desktop.
--1.最初にプライマリキーを削除
SELECT
'ALTER TABLE '
+ tbls.name
+ ' DROP CONSTRAINT '
+ key_const.name + ';' AS "プライマリキーを削除"
FROM
sys.tables AS tbls
INNER JOIN sys.key_constraints AS key_const ON
tbls.object_id = key_const.parent_object_id AND
key_const.type = 'PK'
AND tbls.name like 'TEST_%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment