Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
CREATE PROCEDURE get_empty_tables
AS
DECLARE @cTable_name varchar(100)
DECLARE @cSQL nvarchar(1000)
CREATE TABLE #empty_tables ( TableName varchar(100) )
DECLARE c_tables CURSOR LOCAL FAST_FORWARD
FOR SELECT name
FROM dbo.sysobjects
WHERE OBJECTPROPERTY( ID, N'IsUserTable') = 1
OPEN c_tables
FETCH NEXT FROM c_tables INTO @cTable_name
WHILE @@FETCH_STATUS = 0
BEGIN
SET @cSQL = 'IF ( SELECT COUNT(*) FROM ' + RTRIM( @cTable_name ) + ' ) = 0 INSERT INTO #empty_tables VALUES ( ''' + RTRIM( @cTable_name ) + ''' )'
EXECUTE ( @cSQL )
FETCH NEXT FROM c_tables INTO @cTable_name
END
CLOSE c_tables
DEALLOCATE c_tables
/* result */
SELECT TableName FROM #empty_tables ORDER BY TableName