Following script will provide name of all the stored procedure which were created in last 7 days, they may or may not be modified after that.
SELECT name
FROM sys.objects
WHERE type = 'P'
AND DATEDIFF(D,modify_date, GETDATE()) < 7
You see things; and you say 'Why?' But I dream things that never were; and I say 'Why not?'
Monday, February 9, 2009
To get the row count in a faster way
To get the row count in a faster way , the conventional way would be very slow.
SELECT rows FROM sysindexes
WHERE id = OBJECT_ID('TABLEA') AND indid < 2
TABLEA : Is the name of the table
SELECT rows FROM sysindexes
WHERE id = OBJECT_ID('TABLEA') AND indid < 2
TABLEA : Is the name of the table
Unmatching records between two tables
SELECT SID FROM TABLEA T1 WHERE NOT EXISTS (
SELECT * FROM TABLEB T2
WHERE (T1.SID=T2.SID))
(or)
(select TABLEA.SID from TABLEA) EXCEPT
(select TABLEB.SID from TABLEB)
SELECT * FROM TABLEB T2
WHERE (T1.SID=T2.SID))
(or)
(select TABLEA.SID from TABLEA) EXCEPT
(select TABLEB.SID from TABLEB)
Subscribe to:
Posts (Atom)