Solved

Table Locks and Transaction Log Disabling

Posted on 2002-04-02
2
199 Views
Last Modified: 2012-06-22
I have two stored procedures.  The first dynamically generates a crosstab table (called tbl_Crosstab) based upon a specified date range.  The second gets the data out of this new table, formats it and generates the data for XML output.  These commands are shown below.  The Create SP is used by other areas of the DB so I can't include the display in that SP or use temporary tables.  I am worried that I need to lock the newly created tbl_Crosstab until the data is grabed by the Display SP so that any other resource is not grabbing invalid data.  How do I do this?  Also, if I am creating this new table, are all of the entries being added to the transaction log for the DB?  These values do not need to be backed up (since they change constantly and are only used when created) and they could be creating large transaction logs.  How do I also disable the logging of the creation of the table and data inserts?

EXECUTE usp_CreateCrossTabTable @StartDate, @EndDate
EXECUTE usp_DisplayCrossTabTable_ForXML
0
Comment
Question by:bmccleary
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Accepted Solution

by:
nigelrivett earned 50 total points
ID: 6913817
You cannot stop entries being written to the transaction log as this is used to maintain database integrity.
You could put the new table in it's own database with the log set to truncate on checkpoint.

The create SP is used by other processes? How do you stop these processes conficting with each other?

try

begin tran
select * from newtbl where 1 = 0 (tablockx, holdlock)
EXECUTE usp_CreateCrossTabTable @StartDate, @EndDate
EXECUTE usp_DisplayCrossTabTable_ForXML
commit tran

0
 

Author Comment

by:bmccleary
ID: 6976052
Nigel,
Sometimes I wonder where my brain is at... I apologize for the delay.  I did use your example and it worked.  Thanks!
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question