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 |
|
trento
Starting Member
13 Posts |
Posted - 2009-08-05 : 22:42:38
|
| Hi, Just would like to get and idea how pros do in my situation:I have tab-delimited raw file that hold 50+ columns and I need to load some of them into 20 columns table. I don't have an option to manipulate this raw file outside sql, so i'm thinking to do:1. create table_502. bcp -in file50 into table_50 3. create table_20 as (select column1...column20 from table-50).4. drop table_50will appreciate you feedback. Idon't think i can do it directly in one load with bcp.Thankstrent |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2009-08-05 : 22:56:44
|
| You shouldbe able to load table_20 directly from the data file with BCP using column mappings in a format file.You could also use DTS or SSIS to load table_20 directly from the data file.CODO ERGO SUM |
 |
|
|
trento
Starting Member
13 Posts |
Posted - 2009-08-06 : 00:29:40
|
| Tx, MVJWill look into bcp option now, didn't know that. Is it -h "hint [,...n]" option? Even if wanted columns don't go one after another ?will appreaciate if anybody give me a sample bcp.and I don't have an option to use dts, sisl or etc... just bcp.tx againt |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-08-06 : 06:41:04
|
| Look in Books Online for "bcp format file". You have to dig a little bit, but they have an example of a format file that excludes columns, skips columns, etc. |
 |
|
|
|
|
|