×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

code thinks deleted stored procedure still exists

code thinks deleted stored procedure still exists

code thinks deleted stored procedure still exists

(OP)
Hello,

I'm writing some code to create stored procedures in a database. In order to test it out, I deleted a stored procedure (right clicking in

SQL Server 2008 and clicking on delete) and then ran my code to see if it would create it.

My code looks like this:

CODE

SqlCommand command = new SqlCommand();
SqlConnection conn = database.TypeLibraryDatabaseConnection;

command.Connection = conn;

// create the command to create the stored procedure
command.CommandText = database.GetProcedure(node.Name);

// create the stored proc in the database
try
{
	command.ExecuteNonQuery();
}
catch
{
}

command.Dispose(); 

database.GetProcedure(node.name) basically gets a string containing the SQL script to create the stored procedure.

command.ExecuteNonQuery() throws an SqlException that says: "There is already an object named 'SecuritySession_DeleteSessionById' in the

database." But I deleted it! Why does it think it's still there?

Thanks for any help.

RE: code thinks deleted stored procedure still exists

Hmm, try the simple stuff... are you sure you are hitting the right database? Not a test copy somewhere else?
Does 2008 tombstone deletions? I've been using 2008 mgmt studio, but not 2008 server so I dunno about that.
When you are looking at your connection, double check you arent hitting master, look in master database procedures to see if its in there?
If GetProcedure is a script that creates the proc, are you sure that its not actually creating the proc already?
Good luck!

RE: code thinks deleted stored procedure still exists

(OP)
Turned out I was creating them in the wrong database. Problem solved.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close