Thanks Bryan, the SELECT was the key, I was doing a RETURN!  Sleep
deprivation at its finest...

Jeff Block

-----Original Message-----
From: alpine [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 24, 2002 5:50 PM
To: [EMAIL PROTECTED]
Subject: Re: [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


Have you tried just using an IF EXISTS query?

Something like....

  IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id =
object_id(N'[dbo].[WORKSTATIONS]') AND OBJECTPROPERTY(id, N'IsUserTable') =
1) SELECT 1 ELSE SELECT 0


HTH,
Bryan

_________________________________________________________
New Vision Software         "When the going gets weird,"
Bryan Stafford                "the weird turn pro."
[EMAIL PROTECTED]                   Hunter S. Thompson -
www.mvps.org/vbvision       Fear and Loathing in LasVegas

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


**********************************************************************
This message and any attachments are intended for the
individual or entity named above. If you are not the intended
recipient, please do not forward, copy, print, use or disclose this
communication to others; also please notify the sender by
replying to this message, and then delete it from your system.

The Timken Company
**********************************************************************

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