Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

The following code does work but when the stored procedure is called it takes about 10 seconds for it to load. I am not refering to the 30 minute wait before the name is deleted.

 

Anyone have any ideas why the call would be so slow?

 

SERVICE CODE

conPubs = (New SqlConnection("Server=blah blah blah")

cmdCommand = New SqlCommand("DeleteName", conPubs)

cmdCommand.CommandType = CommandType.StoredProcedure

cmdCommand.Parameters.Add("@Name", Name)

cmdCommand.Parameters.Item(0).Value = Name

conPubs.Open()

cmdCommand.ExecuteNonQuery()

conPubs.Close()

 

STOREDPROCEDURE CODE

Create Procedure[DeleteName]

@Name varchar (30)

As

Begin

Set NoCount On

WaitFor Delay "00:30:00"

Delete From NameTable Where Name = @Name

End

GO

Posted

Ok, I read in the Sql Server documentation that this is not the proper way to use 'waitfor'.

 

I now use the Sql Server Agent to execute the Job.

Works perfectly!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...