CCommand Open freezing.



Hi,
I execute the following statement in a database;

if exists (SELECT [dbo].[sysobjects].[name] FROM [dbo].[sysobjects]
WHERE [dbo].[sysobjects].[name] = N'sp_SomeStoredProc' AND
[sysobjects].[type] = N'P' ) DROP PROCEDURE [dbo].[sp_SomeStoredProc']

it used to work with SQL Server 2000 but hangs/freezes indefinitely
when run with SQL Server 2005.

it was originally like this:

IF EXISTS (SELECT name FROM sysobjects WHERE name =
'sp_SomeStoredProc' AND type = 'P') DROP PROCEDURE [sp_SomeStoredProc]

but my changes (putting name and type columns into [...], etc) did not
help. still freezing.

I run several other statements before and they end successfully. I
even run:

IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].
[SomeTable]') AND OBJECTPROPERTY(id, N'IsUserTable') = 1) DROP TABLE
[dbo].[SomeTable]

and it still goes fine.

only in the case of :
IF EXISTS (SELECT name FROM sysobjects WHERE name =
'sp_SomeStoredProc' AND type = 'P') DROP PROCEDURE [sp_SomeStoredProc]

or

if exists (SELECT [dbo].[sysobjects].[name] FROM [dbo].[sysobjects]
WHERE [dbo].[sysobjects].[name] = N'sp_SomeStoredProc' AND
[sysobjects].[type] = N'P' ) DROP PROCEDURE [dbo].[sp_SomeStoredProc']

it freezes, even though the stored procedures NEVER exist, so the
problem should be somewhere in the select statements, not in the
dropping of procedures itself. Plus: I can run the statements from SQL
Server Management Studio console and they still run fine! Does ADO
interpret something wrongly?

Many thanks in advance!

.



Relevant Pages

  • Re: Unable to view system stored procedures from .NET IDE and unable to debug SQL
    ... But what is the reason for the debug problem I mentioned below? ... try to step into a stored procedure in the Northwind database, ... Run SQL server setup or contact database ... I can't see any system stored procedures in master. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Identical database w/ identical stored procedures?
    ... > creating the maintence nightmare of updating the same stored procedure ... First of all, put your source code, tables, stored procedures and all ... This can be achieved with a help table in the database. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)
  • Re: Debugging in VS.NET
    ... > "Cannot debug stored procedures because the SQL Server database is not ...
    (microsoft.public.sqlserver.msde)
  • Extreme performance issues (SQL Server 2000/ADO.NET/C#)
    ... This process runs very quickly if run through Query ... same exact stored procedures and views, run in the same exact order, through ... system that runs SQL Server (a 4-cpu Xeons system with 2gigs of physical ... When I execute these steps manually through query analyser,, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Query Analyzer Connect Option
    ... the database, but the users only have SELECT access. ... through stored procedures. ... As Mary pointed out, giving users full access to the database, and ... Books Online for SQL Server SP3 at ...
    (microsoft.public.sqlserver.tools)