0

Is there a way to lock an entire database from writing but at the same time storing the incoming requests in a queue or in memory until the lock is released?

edit 1: I'm looking for something similar to MySQL

'FLUSH TABLES WITH READ LOCK' and 'UNLOCK TABLES'

Thanks

5
  • Locking an entire database is a very bad idea. Commented Feb 10, 2015 at 18:02
  • I'm not exactly sure what you're looking for, but this might help: rusanu.com/2010/03/26/using-tables-as-queues Commented Feb 10, 2015 at 18:04
  • Offtopic. Not really a programming question. Try the DBA site. Commented Feb 10, 2015 at 18:05
  • I know it's a bad idea but this is one of my requirenments :( Commented Feb 10, 2015 at 18:07
  • SQL Server does have lock hints. Just google it. Commented Feb 10, 2015 at 18:09

1 Answer 1

1

You can add table level lock hints with (tablock) or with (tablockx) depending if you need shared or exclusive lock -- that's of course per table.

TABLOCK vs TABLOCKX

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.