Click here to Skip to main content
15,914,780 members
Home / Discussions / Database
   

Database

 
GeneralRe: MySQL and Images Pin
Paul Conrad23-Dec-07 6:09
professionalPaul Conrad23-Dec-07 6:09 
GeneralRe: MySQL and Images Pin
Mike L.23-Dec-07 11:38
Mike L.23-Dec-07 11:38 
GeneralRe: MySQL and Images Pin
Paul Conrad23-Dec-07 13:40
professionalPaul Conrad23-Dec-07 13:40 
GeneralRe: MySQL and Images Pin
Mike L.23-Dec-07 13:44
Mike L.23-Dec-07 13:44 
GeneralRe: MySQL and Images Pin
Paul Conrad23-Dec-07 13:52
professionalPaul Conrad23-Dec-07 13:52 
GeneralRe: MySQL and Images Pin
Mike L.23-Dec-07 13:59
Mike L.23-Dec-07 13:59 
GeneralRe: MySQL and Images Pin
Paul Conrad23-Dec-07 14:21
professionalPaul Conrad23-Dec-07 14:21 
GeneralRe: MySQL and Images Pin
Mike L.24-Dec-07 16:28
Mike L.24-Dec-07 16:28 
GeneralRe: MySQL and Images Pin
Paul Conrad24-Dec-07 16:44
professionalPaul Conrad24-Dec-07 16:44 
Generalconnecting to mssql 2005 express from vs2008 - RESOLVED Pin
l a u r e n22-Dec-07 21:06
l a u r e n22-Dec-07 21:06 
GeneralHelp in query design Pin
NetBot22-Dec-07 18:08
NetBot22-Dec-07 18:08 
GeneralRe: Help in query design Pin
Paul Conrad23-Dec-07 6:14
professionalPaul Conrad23-Dec-07 6:14 
GeneralTransfer records From Local To Host Pin
mehrdadc4822-Dec-07 9:01
mehrdadc4822-Dec-07 9:01 
GeneralRe: Transfer records From Local To Host Pin
DigiOz Multimedia22-Dec-07 11:49
DigiOz Multimedia22-Dec-07 11:49 
GeneralChecking Details to Display Pin
ShimnaMukundan21-Dec-07 18:46
ShimnaMukundan21-Dec-07 18:46 
GeneralRe: Checking Details to Display Pin
pmarfleet21-Dec-07 22:25
pmarfleet21-Dec-07 22:25 
GeneralCheck box = Unchecked Pin
s3rro21-Dec-07 8:00
s3rro21-Dec-07 8:00 
GeneralRe: Check box = Unchecked Pin
pmarfleet21-Dec-07 9:07
pmarfleet21-Dec-07 9:07 
GeneralRe: Check box = Unchecked Pin
Dave Kreskowiak21-Dec-07 9:51
mveDave Kreskowiak21-Dec-07 9:51 
GeneralRe: Check box = Unchecked Pin
GuyThiebaut23-Dec-07 10:44
professionalGuyThiebaut23-Dec-07 10:44 
GeneralDeleteing From Table A When Records Not Found in Table B Pin
gunner_uk200021-Dec-07 3:26
gunner_uk200021-Dec-07 3:26 
GeneralRe: Deleteing From Table A When Records Not Found in Table B Pin
Michael Potter21-Dec-07 4:24
Michael Potter21-Dec-07 4:24 
QuestionInserting bulk data to SQL DB (SQL 2000) [modified] Pin
Daminda21-Dec-07 1:51
Daminda21-Dec-07 1:51 
I am generating bulk invoices using front end and when I try to insert it to the data base it takes hours it’s unacceptable.

This is how I am doing the task
Get relevant Cx accounts to data tables
Generates Invoice header and detail records and store those records on Invoice Header and Detail Data tables

Loop the invoice header data table and Insert recodes using Strode procedure.
Loop the invoice detail data table and Insert recodes using Strode procedure.

To generate for 200000 invoices it takes more than 24 Hrs.

How can I improve the performance?

Please refer the code.


//Inserting the Invoice Header records
foreach(DataRow InvHDR in DS_BillData.Tables["InvoiceHeaderInformation"].Rows)
{

SqlParameter[] para =new SqlParameter[14];
para[0]=new SqlParameter("@GUAccountID",InvHDR["GUAccountID"]);
para[1]=new SqlParameter("@GUInvID",InvHDR["GUInvoiceID"]);
para[2]=new SqlParameter("@InvoiceNo",InvHDR["InvoiceNo"]);
para[3]=new SqlParameter("@InvoiceDate",StartDate);
para[4]=new SqlParameter("@DueDate",DueDate);
para[5]=new SqlParameter("@BatchNo",BatchID);
para[6]=new SqlParameter("@GUStatmentID",InvHDR["GUInvoiceID"]);
para[7]=new SqlParameter("@BatchSNCount",BatchSNCount);
para[8]=new SqlParameter("@PAYMENTRECIVED",InvHDR["PAYMENTRECIVED"]);
para[9]=new SqlParameter("@SubTotal",InvHDR["SubTotal"]);
para[10]=new SqlParameter("@InvoiceAmount",InvHDR["InvoiceAmount"]);
para[11]=new SqlParameter("@VAT",InvHDR["VAT"]);
para[12]=new SqlParameter("@OtherTax",InvHDR["OtherTax"]);
para[13]=new SqlParameter("@StatmentNo",InvHDR["InvoiceNo"]);
//para[13]=new SqlParameter("@WaveOFF","Y");

callSp("BillingInvoiceCreation_forFront",para);

}

Stored Procedure---

Procedure BillingInvoiceCreation_forFront
(
@GUAccountID as nvarchar(30),
@GUInvID as nvarchar(30),
@InvoiceNo as numeric,
@InvoiceDate as datetime,
@DueDate as datetime,
@BatchNo as Decimal,
@GUStatmentID as nvarchar(30),
@StatmentNo as numeric,
@BatchSNCount as decimal,
@PAYMENTRECIVED as decimal(9,2),
@SubTotal as decimal(9,2),
@InvoiceAmount as decimal(9,2),
@VAT as decimal(9,2),
@OtherTax as decimal(9,2)

)
as
BEGIN

Declare @PrintDescription as nvarchar(100)
Declare @GUItemID as nvarchar(30)
Declare @PaymentAmt as decimal(9,2)
Declare @DueAmount as decimal(9,2)
Declare @CreditNoteAmount as decimal(9,2)
Declare @BFAmount as decimal(9,2)





INSERT INTO B_BillingInvoiceHeader(StatementNo, GUStatementID, GUInvID,
CompanyID, LocationID, BranchID, DeptID, InvoiceNo,
InvoiceDate, DueDate, Status, GUAccountID, ManualInvoice,
BatchNo, InvoiceType,BatchSNCount,BillingYear,BillingMonth,SubTotal,InvoiceAmount,VAT,OtherTax)
VALUES(@StatmentNo, @GUStatmentID, @GUInvID,
1, 1, 1, 1, @InvoiceNo,
@InvoiceDate, @DueDate, 'New', @GUAccountID, 'N',
@BatchNo, 'Batch',@BatchSNCount,year(@InvoiceDate),month(@InvoiceDate),@SubTotal,@InvoiceAmount,@VAT,@OtherTax)





SELECT @BFAmount=isnull(SUM(InvoiceAmount - PaidAmount),0)
FROM B_BillingInvoiceHeader
WHERE (GUAccountID = @GUAccountID) AND (PaymentCompleted = N'N') AND BatchNo<@BatchNo


/*_________________ Add Sanka ______________________*/







exec BillingCustomerAdvances @GUInvID


--- Late Invoice Delocate-----------------------------------------------------------------<<(*_*)>>-----

SELECT @PaymentAmt = PaymentReceve From B_CustomerPaymentRec Where GUAccountID=@GUAccountID And BatchNo=@BatchNo

SELECT @CreditNoteAmount=isnull(SUM(Amount) ,0)
FROM B_CreditNote
WHERE (Status='APPROVED') And (Completed ='N') AND (GUAccountID = @GUAccountID)



INSERT INTO B_MonthlyOpenningBalance
(GuAccountID, BatchNo, OppenningBalance, ClosingBalance, CreditNote, AdvanceBalance, UtilizedCredits)
VALUES (@GuAccountID, @BatchNo, @BFAmount, @BFAmount+@InvoiceAmount, @CreditNoteAmount, 0, 0)


INSERT INTO B_MonthlyBF
(CompanyID, LocationID, BranchID, DeptID, BatchNo, BFAmount, GUAccountID)
VALUES (1, 1, 1, 1, @BatchNo, @BFAmount, @GUAccountID)


Update B_CreditNote Set Completed ='Y' WHERE (Status='APPROVED') And (Completed ='N') AND (GUAccountID = @GUAccountID)




END

------

Thanks for the help i am working on DTS update method con any one give me a direction or small sample code kind of a thing?

Regards,
Daminda.
modified on Friday, December 21, 2007 9:30:11 AM

GeneralRe: Inserting bulk data to SQL DB (SQL 2000) Pin
pmarfleet21-Dec-07 2:23
pmarfleet21-Dec-07 2:23 
GeneralRe: Inserting bulk data to SQL DB (SQL 2000) Pin
Paddy Boyd21-Dec-07 2:27
Paddy Boyd21-Dec-07 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.