Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
The transaction log for database 'My DB' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases

I have created an spring batch application ,it will read some crore of rows from a text file and update it in to staging Table(Tblm My table) in some regular interval of time after reading all data to staging table my stored procedure will execute it will delete old record from my main table and insert data from staging table to main table in bulk but its is not success am getting The transaction log for database 'My DB' is full.error

My Admin is not increasing disk space he ask as to change my stored procedure to do bulk insert Iam using simple insert query to insert data from one table to another

SP Below
SQL
IF @BenefitYear = 2013 BEGIN

INSERT INTO mainTable

   (userid,username,addr,ucost,unitcost90,benefityear,datecreated,createduser) 

SELECT userid,username,addr,ucost,unitcost90,@BenefitYear, current_timestamp,@BatchUser

From stagingTable

END
Posted
Updated 7-Oct-13 23:01pm
v3

1 solution

Use the below query for Bulk copying -

SQL
BULK INSERT pubs..publishers2 FROM 'c:\newpubs.dat'
WITH (
   DATAFILETYPE = 'char',
   FIELDTERMINATOR = ',',
   ROWTERMINATOR = '\n'
)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900