23.4.11

Sql Queries Information

1.)if you want to check, last 7 days sp created in database use this..

SELECT * FROM sys.objects WHERE type = 'P' AND DATEDIFF(D,create_date, GETDATE()) < 7


2.)Find Text In Store Procedure:

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%Users%'
AND ROUTINE_TYPE='PROCEDURE'


3.) Check tables created in database last 7 days:

SELECT * FROM sys.tables WHERE type = 'U' AND DATEDIFF(D,create_date, GETDATE()) < 14


4.) List of All tables in Database:

SELECT * from sys.tables where type_desc = 'USER_TABLE'

5.) List of All users Sps in Database.
SELECT * FROM sys.objects WHERE type = 'P'

No comments: