I would suggest taking a look in the sysobjects table to find out if the
objects exist.


Regards,
Amanuel





                        Stephen Crabb          To: [EMAIL PROTECTED]
                        <[EMAIL PROTECTED]        cc:
                        L>                     Subject:  Re: [DOTNET] Checking 
Existance and Creating SqlServer Objects
                        Sent by: dotnet
                        discussion
                        <DOTNET@DISCUSS
                        .DEVELOP.COM>


                        04/25/2002
                        09:21 AM
                        Please respond
                        to dotnet
                        discussion






"Well, the last isue would be a select *, but then you run the chance of
getting all the data dumped."

or "select * from tablename where 1=0"  so no data is dumped and empty
table
results or an error (which you handle)

Stephen Crabb


-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]]On Behalf Of
Thomas Tomiczek
Sent: 25 April 2002 06:57
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Checking Existance and Creating SqlServer Objects


Yes, there is - you can even do it in the create SQL Statement. At least
with SQL Server 2000. Otherwise not really.

Well, the last isue would be a select *, but then you run the chance of
getting all the data dumped.

SQL Actually defines schema views that awould allow you to query for
objects, BUT - if you are not for a specific dtabase (or set thereof) I
think not all databases support the schema views yet.

Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)



-----Original Message-----
From: Jeff Block [mailto:[EMAIL PROTECTED]]
Sent: Mittwoch, 24. April 2002 23:11
To: [EMAIL PROTECTED]
Subject: [DOTNET] Checking Existance and Creating SqlServer Objects


Is there a way to query for the existance of tables and stored
procedures from C#?  From VB6 land I was using SQLDMO, but can't seem to
figure it out through interop in C#.  I want to be able to create
tables, but only if they don't exist first, stored procedures I would
most likely want to just drop and recreate.  Any thoughts would be very
appreciated!

TIA...

Jeff

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to