5 pts.
 ‘m trying to verify that a SQL DATABASE is empty ,
I am modifying a VB program that is taking ALL the tables from an ACCESS Database and converting them to a SQL DATABASE. They VB Program opens the SQL DATABASE, but I want to verify the database is completely empty. Is there a function or call that can be added to the code??

Software/Hardware used:
ASKED: February 8, 2008  7:12 PM
UPDATED: February 8, 2008  7:42 PM

Answer Wiki:
There's no function, but you can query the system and see what's in there. SQL 7/2000 To look and see if there are any tables in the database. <pre>SELECT * FROM sysobjects WHERE xtype = 'U' and name <> 'dtproperties' /*This table is used for the database diagrams, so you don't want to delete it.*/ </pre> To look and see if there are any views in the database. <pre>SELECT * FROM sysobjects WHERE Xtype = 'V'</pre> To look and see if there are any procedures in the database. <pre>SELECT * FROM sysobjects WHERE xtype = 'P'</pre> SQL 2005+ To look and see if there are any tables in the database. <pre>SELECT * FROM sys.tables</pre> To look and see if there are any views in the database. <pre>SELECT * FROM sys.views</pre> To look and see if there are any procedures in the database. <pre>SELECT * FROM sys.procedures</pre>
Last Wiki Answer Submitted:  February 8, 2008  7:41 pm  by  Denny Cherry   64,520 pts.
All Answer Wiki Contributors:  Denny Cherry   64,520 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.

 64,520 pts.