Last active
November 14, 2018 21:02
-
-
Save kadru/f0ad8bc38349561294b08a1c5006d9e1 to your computer and use it in GitHub Desktop.
sql meta queries
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
SELECT DATA_TYPE | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE | |
TABLE_NAME = 'yourTableName' | |
COLUMN_NAME = 'yourColumnName' |
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
-- list store procedures | |
SELECT OBJECT_NAME(object_id) | |
FROM sys.sql_modules | |
WHERE OBJECTPROPERTY(object_id, 'IsProcedure') = 1 | |
AND definition LIKE '%dsidr4%' | |
---------------------------------------------- | |
SELECT ROUTINE_NAME, ROUTINE_DEFINITION | |
FROM INFORMATION_SCHEMA.ROUTINES | |
WHERE ROUTINE_DEFINITION LIKE '%Foo%' | |
AND ROUTINE_TYPE='PROCEDURE' | |
---------------------------------------------- | |
SELECT OBJECT_NAME(id) | |
FROM SYSCOMMENTS | |
WHERE [text] LIKE '%Foo%' | |
AND OBJECTPROPERTY(id, 'IsProcedure') = 1 | |
GROUP BY OBJECT_NAME(id) | |
--list of linked servers | |
select * from sys.servers | |
-- list of synonyms | |
select * from sys.synonyms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment