Skip to content

Instantly share code, notes, and snippets.

@ksakae1216 ksakae1216/sql1
Created May 17, 2017

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
You can’t perform that action at this time.