I have the following table in my SQL Server 2008 database:
CREATE TABLE [dbo].[SomeTable]
(
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[Column1] [varchar](30) NOT NULL,
[Column2] [varchar](30) NOT NULL,
[Column3] [varchar](50) NOT NULL,
CONSTRAINT [PK_SomeTable] PRIMARY KEY CLUSTERED
(
[Id] ASC
)
)
One process inserts data into this table, another process reads all data from this table. Both processes work simultaneously.
one process:
INSERT INTO dbo.SomeTable VALUES ('col1', 'col2', 'col3')
another process:
SELECT Id, Column1, Column2, Column3 FROM dbo.SomeTable
I see that second query does a full table scan, but I need to get all data from this table for further processing(it won't be a very big table, because it will be cleaned periodically. it will contain a 1K-2K rows).
Are there any way to make sure that deadlocks will never happen for this two queries?