Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
oufan222
Starting Member
6 Posts |
Posted - 2010-03-27 : 21:24:43
|
| I'm new to SQL programming, but I've been reading for several months now. However, I can't seem to find a solution to a problem I am having.I have a tab delimited file of project data that I need to import into a SQL Server DB. I can read the file into a datatable in C# and use a dataadapter to import the the complete data set into the DB, no problem.However, for my database design to be more efficient, it is required that I split the input file into multiple tables and use foreign keys to point to repeated fields. What is the best way to split my datatable into multiple tables? I've been reading about LINQ, because I think it allows me to query a datatable to only pull out the fields I need. However I'm not sure what to do with the query results once I obtain them. Do I insert them into a datatable (so I can use a dataadapter to insert them into my DB)? If so, how is this done? Is this the best way to accomplish what I am trying to do?Thanks in advance for any help. |
|
|
Sachin.Nand
2937 Posts |
|
|
oufan222
Starting Member
6 Posts |
Posted - 2010-03-29 : 21:44:39
|
| That doesn't really answer my question... I know how to insert data into the database using a dataadapter. The problem is with splitting the data from a datatable. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
oufan222
Starting Member
6 Posts |
Posted - 2010-03-30 : 08:30:09
|
| Can SQL only pull from certain columns in the tab delimited file? The problem is I have a very large file that I need to split into multiple tables.BTW, I think I'm almost there. If I could get the sqldataadapter to work I would be finished (I think). When I use the sqldataadapter to fill a datatable, the primary key information does not get addeded to my datatable. When I use MissingSchemaAction.AddWithKey, primary key information is added to my datatable, but the autoincrement properties are somehow missing. I'm a little timid to set those in my c# app myself. It seems like those should be inherited via the MissingSchemaAction.AddWithKey call. |
 |
|
|
|
|
|
|
|