This is a good link describing Object Property in SQL
Friday, May 16, 2008
How To Execute Alter Statement within IF Exists block in SQL server
To execute DML statement within IF block we need to use command named "EXEC"..
E.g.
IF EXISTS(SELECT * from SYSOBJECTS WHERE name LIKE 'XXXXXX')
BEGIN
EXEC(' ALTER TABLE XYZ ............')
END
How to find dependancies for SQL server
We could use sp_depends XXXXXXXXX system stored procedure to retrieve all the dependant components. But sometime this SP doesn't list all of them. So to be on a safer side in addition to sp_depends use the following steps:
1. Get ObjectID from Sysobjects table.
--> Select * from Sysobjects where name like 'XXXXXXXX' - Get ObjectID
2. Next, Get the objects from Sysobjects table where the parentid = ObjectID
--> Select * from Sysobjects where ParentID=ObjectID
Subscribe to:
Posts (Atom)