I was using the sp_helptext very frequently to get the definition of an object.
Here is another easy way to get the definition of an object
SELECT OBJECT_DEFINITION(object_id) FROM sys.objects WHERE type='V'
You can use the, ALTER in the result set of the above query by using the REPLACE.
In the where condition you can specify the Procedure(P) or Functions(FN) as well.
Showing posts with label SQL Scripts. Show all posts
Showing posts with label SQL Scripts. Show all posts
Monday, April 11, 2011
Tuesday, March 22, 2011
Find Created date and Modified date of Database objects
This script will return the objects in sql server database with modified and created date.
However you can change the order by clause as well as the Where clause according to your requirements
SELECT sys.schemas.name + '.' + sys.objects.name,
create_date,
modify_date
FROM sys.objects
INNER JOIN sys.schemas ON sys.objects.schema_id = sys.schemas.schema_id
WHERE type = 'P'
OR type = 'U'
OR type = 'FN'
OR type = 'V'
ORDER BY modify_date DESC
However you can change the order by clause as well as the Where clause according to your requirements
SELECT sys.schemas.name + '.' + sys.objects.name,
create_date,
modify_date
FROM sys.objects
INNER JOIN sys.schemas ON sys.objects.schema_id = sys.schemas.schema_id
WHERE type = 'P'
OR type = 'U'
OR type = 'FN'
OR type = 'V'
ORDER BY modify_date DESC
Subscribe to:
Posts (Atom)