Jump to content

SQL Experts Please help


4Vikram

Recommended Posts

Naak requirement...

 

CSV File nunchi server ki data import kavali through bulk load and this should be in a package..

here are twists:

CSV file lo columns and rows chaala unai and ee columns change aituntai so the it should be a dynamic script..

Table name i am from file name, so everytime data update ainapudu table drop avali and same table name tho kotha table create ai data load kavali

Metadata vala C# code use chestuna, na degara oka code undi adi bane working but point endi anta ade bulk load avatledu, line by line aitundi.. so idhi requirement,,

 

please any one help urgent important mandatory situation.. thanks in advance.. 

Link to comment
Share on other sites

sorry man poker tournament aadutundey when you called.. now driving back home... texting from phone.   Basically solution goes like this.. 

First take the file name and drop the table. 

Use streamreader in c# and read only columns and dynamically create new table with file name.

Use dynamic configurations for both flat file and table name and load sql table using regular data flow task.

Come back and thank me.. good luck man...

Link to comment
Share on other sites

19 minutes ago, loveindia said:

sorry man poker tournament aadutundey when you called.. now driving back home... texting from phone.   Basically solution goes like this.. 

First take the file name and drop the table. 

Use streamreader in c# and read only columns and dynamically create new table with file name.

Use dynamic configurations for both flat file and table name and load sql table using regular data flow task.

Come back and thank me.. good luck man...

one mukka ardam aite hit with cheppuls uncle man 

Link to comment
Share on other sites

39 minutes ago, loveindia said:

sorryman poker tournament aadutundey when you called.. now driving back home... texting from phone.   Basically solution goes like this.. 

First take the file name and drop the table. 

Use streamreader in c# and read only columns and dynamically create new table with file name.

Use dynamic configurations for both flat file and table name and load sql table using regular data flow task.

Come back and thank me.. good luck man...

brahmi%20laugh_01.gif?1403646236

Link to comment
Share on other sites

1. Read the table name from csv file. Drop the table in db.

2. Read the first line  from file and now you have tablename and all column names. Send query to create table.

3. Use SqlBulkCopy to throw the data on to the table. 

Note: dont use async(incase the data is ready to be thrown before actual table got created), if the data size is huge do the bulk copy in batches 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...