Last active
January 28, 2019 15:56
-
-
Save kadru/9d29852c96f2442e51545f9d5348de4a to your computer and use it in GitHub Desktop.
autofix and other utilities sql server.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXEC sp_change_users_login 'Auto_Fix', 'user', NULL, 'pass' | |
-- constraints information | |
SELECT * FROM sys.objects | |
WHERE type_desc LIKE '%CONSTRAINT' | |
SELECT * | |
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS | |
where CONSTRAINT_NAME = 'constraint_name' | |
SELECT OBJECT_NAME(object_id) AS ConstraintName, | |
SCHEMA_NAME(schema_id) AS SchemaName, | |
type_desc AS ConstraintType | |
FROM sys.objects | |
WHERE type_desc LIKE '%CONSTRAINT' AND OBJECT_NAME(parent_object_id)='constraint_nem' | |
--constraints from a table | |
exec sp_helpconstraint 'table_name' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment