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 |
Beachsandintoes
Starting Member
15 Posts |
Posted - 2005-09-29 : 12:36:27
|
Hi,How do we skip fixed-width columns using a format file? For example, we only need to import first and last names from the sample text file. Note the forum tool strips out extra spaces. The actual file starts a new column every 10 characters(First Name is 1 - 10, Middle Name is 11 - 20, Last Name is 21 - 30) :FIRST MIDDLE LASTDAVID LEE ROTHALFRED E NEWMANEDGAR ALLEN POEWe could import all three columns using a format file like:8.031 SQLCHAR 0 10 "" 1 First_Name2 SQLCHAR 0 10 "" 2 Middle_Mame3 SQLCHAR 0 10 "\r\n" 3 Last_NameBut, we need somethng more like:8.031 SQLCHAR 0 10 "" 1 First_Name3 SQLCHAR 0 10 "\r\n" 3 Last_NameAlso, what would we do if we only needed the first two columns? In this caswe, we wouldn't be able to specify the row terminator.8.031 SQLCHAR 0 10 "" 1 First_Name2 SQLCHAR 0 10 "" 2 Middle_MameAs always, thank you for your time and insights.- Beach |
|
X002548
Not Just a Number
15586 Posts |
|
Beachsandintoes
Starting Member
15 Posts |
Posted - 2005-09-29 : 14:05:40
|
Heh heh, yes. So here it is the collation friendly version.8.031 SQLCHAR 0 10 "" 1 First_Name SQL_Latin1_General_CP1_CI_AS2 SQLCHAR 0 10 "" 2 Middle_Mame SQL_Latin1_General_CP1_CI_AS3 SQLCHAR 0 10 "\r\n" 3 Last_Name SQL_Latin1_General_CP1_CI_ASPlease no e-mails from the Collation Coalition telling me about how I was being insensitive to the needs of Collation.- Beach |
 |
|
|
|
|