run this and then try your insert…
select * from yourTable with (holdlock,tablockx)
here, you can lock it for 5 minutes:
BEGIN TRANSACTION
SELECT * FROM yourTable WITH (TABLOCKX, HOLDLOCK)
WHERE 0 = 1
WAITFOR DELAY '00:05'
ROLLBACK TRANSACTION
More Related Contents:
- Optimistic vs. Pessimistic locking
- Confused about UPDLOCK, HOLDLOCK
- Is it possible to set a timeout for a SQL query on Microsoft SQL Server?
- SQL Server, the misleading XLOCK & optimizations
- In SQL Server, how can I lock a single row in a way similar to Oracle’s “SELECT FOR UPDATE WAIT”?
- ADO.NET calling T-SQL Stored Procedure causes a SqlTimeoutException
- How to convert SQL Server’s timestamp column to datetime format
- Local and global temporary tables in SQL Server
- Multiple rows to one comma-separated value in Sql Server [duplicate]
- SQL Server add auto increment primary key to existing table
- SQL Server: Difference between PARTITION BY and GROUP BY
- How do you truncate all tables in a database using TSQL?
- EF5: Cannot attach the file ‘{0}’ as database ‘{1}’
- SQL Server: How to select all days in a date range even if no data exists for some days
- SQL – The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
- TSQL: How to convert local time to UTC? (SQL Server 2008)
- SQL Server datetime LIKE select?
- Transpose rows and columns with no aggregate
- How can I import an Excel file into SQL Server? [closed]
- Possible to set default schema from connection string?
- Stored Procedure and Permissions – Is EXECUTE enough?
- Best way to store time (hh:mm) in a database
- Using variable in SQL LIKE statement
- Stored procedure – return identity as output parameter or scalar
- Why does a parameterized query produces vastly slower query plan vs non-parameterized query
- SELECT INTO a table variable in T-SQL
- SQL Server: Filter output of sp_who2
- How can I insert binary file data into a binary SQL field using a simple insert statement?
- Table Valued Function Killing My Query Performance
- How to do Sql Server CE table update from another table