Import operation | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Import operation

Hello!<br /><br /> I have a table that has the following structure:<br /> Id (bigint, identity), date (datetime), status (int), and 155 colums (varchar(200)).<br /> In this table I have some Import data that I must distribute into another several tables. For this i have made a stored procedure (myImport) i which i have the following code:<br /> – I declare local variables (nvarchar(200)) for each 155 column.<br /> – I declare a cursor in which i select all the rows from my Import table where status = 0 (with FAST_FORWARD option for the cursor).<br /> – then I FETCH each line from the cursor, put in my local variables the values for each column and call another stored procedure (myImportRow) which takes as parameters my local variables.<br /> In myImportRow stored procedure i call another several stored procedures that inserts data into my tables. In each of those stored procedure i determine an OUTPUT parameter that is used in the next stored procedure that i call.<br /><br /> Can someone tell me a better solution to my import operation ?<br /> I have tried with a temporary table instead of the cursor….but that was worst <img src=’/community/emoticons/emotion-6.gif’ alt=’:(‘ /><br /><br /> Thx in advance!

You may consider this approach Insert into targetTable(columns)
Select columns from SourceTable
Where <condition> Madhivanan Failing to plan is Planning to fail
I need to process row by row and to insert the information into several tables.
I have tried with a temporary table instead of the cursor….but that was worst
What was the problem with temp tables?
Have you checked the contention of tempdb during this operation?
What was the log growth during this operation? Satya SKJ
Contributing Editor & Forums Moderator
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.