Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8592647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:48:02+00:00 2026-06-11T23:48:02+00:00

I declared a table in my procedure which you can see below: Declare @resultTable

  • 0

I declared a table in my procedure which you can see below:

Declare @resultTable Table
(
  EmpId int,
  EmpStatusId int,
  CreatedDateTime datetime
)

and i perform a delete function:

Delete From ActualTable
Where Id = (Select EmpId from @resultTable with (nolock) where EmpStatusId = @tempId)

i am trying to avoid locking in the select statement to avoid deadlock even if i read a dirty data. However, “with (nolock)” is not allowed. The error says:

Incorrect syntax near the keyword ‘with’. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.

Is there a way to apply NOLOCK in a temporary table?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:48:04+00:00Added an answer on June 11, 2026 at 11:48 pm

    I’d question whether you’re asking the right question:

    You own the table variable (note: its not a temp table, but a table variable), so there’s no point issuing a nolock against it. You appear to want nolock issued against the target table, ActualTable, but a delete HAS to hold locks. Period.

    The usual technique with handling large delete operations is to issue the deletes in batches of row ranges.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've the following procedure which says can't reopen table why it is giving this
DECLARE @table table(XYZ VARCHAR(8) , id int) INSERT INTO @table SELECT '4000', 1 UNION
The Table: declare @Table table ( id int, ticketid int, sponsor int, dev int,
i have two table: declare @t1 table (id int) declare @t2 table (id int)
CREATE TABLE #Report( Cell int, CellValue double) Error here DECLARE @Report TABLE ( Cell
Assume I have some stored procedure (and I can't change it) which is returning
Given the following procedure call which returns an application-managed unique integer: DECLARE @id as
Using sqlplus how can I execute a stored procedure which has arguments which are
I have made a procedure in PL/SQL which inserts data from one table to
I am writing a stored procedure, which opens a cursor to a table, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.