Monday, August 01, 2005

Retrieving results from system stored procedures

For instance:

INSERT INTO #sp_helpprotect_results
EXEC sp_helprotect NULL

Don't forget create a table structure with the same number of fields

Obtaining the size of the MDF file

SELECT size*8192 as FileSize
FROM master..sysaltfiles
WHERE fileid=1
AND dbid=DB_ID('')

The faster way to know if an object exists or not

SELECT OBJECT_ID('Prueba1SQL..testenr')