Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

loading Data from CSV file into Sql server tables

$
0
0

Hi i am trying to load data from CSV file to multiple sql server tables and some of the tables having Reference to parent tables so i can get the FK column value but trying to load via INSERT INTO sql, i am having issue when i have to load data from staging table and get the keyID from Parent tables, it's only getting last value from that parent table instead of all the parent IDs. Ex. PARENT 1 table during load - P1ID is from 1 to 799 PARENT 2 Table during load - P2ID is from 2 to 799 but Child Table during same load - C1ID is only 800 repeating for all the 799 rows and same for other P2ID should load all the 799 but repeating 800 value for all 799 rows. I am using following script:

Text
DECLARE @DCID INT, -- Parent Key Column with Identity in DC Table @FCID INT , -- Parent Key column with Identity in FC Table @DNCID INT -- Parent...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>