Skip to content

Instantly share code, notes, and snippets.

@ksakae1216
Created May 17, 2017 14:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
--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