Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Why can't I create record in one table.

Author  Topic 

Cecilia1997
Starting Member

5 Posts

Posted - 2008-10-30 : 16:32:19
I was trying to create record in one table, but I keep getting timeout. I restart my SQL server, then it's working. Anybody has any idea?

hanbingl
Aged Yak Warrior

652 Posts

Posted - 2008-10-30 : 16:53:17
Please specify how are you creating records...

If you can't insert the table maybe locked and you'll get a max lock timeout.

Use SP_who2 to determine the blocking table.
Go to Top of Page

Cecilia1997
Starting Member

5 Posts

Posted - 2008-10-30 : 17:10:01
I was using a sp to insert into a table.

Create Procedure [dbo].[SP]
(
@Data xml
)

As

Set NoCount On

Insert Into [dbo].[Table]
(
[Data]
)
Values
(
@Data
)

SELECT SCOPE_IDENTITY() As [id]

Set NoCount Off

Return(0)

Go to Top of Page

hanbingl
Aged Yak Warrior

652 Posts

Posted - 2008-10-30 : 17:24:58
If you get locked again, use SP_WHO2 to see which SPID is blocking. And use DBCC INPUTBUFFER(SPID) to see what's going on in there.
Go to Top of Page
   

- Advertisement -