dbTalk Databases Forums  

How to import fixed-width text file in MS SQL 2000?

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss How to import fixed-width text file in MS SQL 2000? in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tom
 
Posts: n/a

Default How to import fixed-width text file in MS SQL 2000? - 01-17-2005 , 01:09 PM






Hello,

Is there a simple answer to this simple question?

How to import fixed-width text file?

I know the width of the columns but there are so many that I don't want
redefine them. I have already a table build for that data with the necessary
fields width. In dbase it was such a simple thing to do...

Note:
I went through the Import wizard in MS SQL 2000 and I could not find any
thing there about importing fixed-width text file.


Any help is greatly appreciated,
Les



Reply With Quote
  #2  
Old   
Dejan Sarka
 
Posts: n/a

Default Re: How to import fixed-width text file in MS SQL 2000? - 01-18-2005 , 02:08 AM






Quote:
Note:
I went through the Import wizard in MS SQL 2000 and I could not find any
thing there about importing fixed-width text file.
The wizard does not have the option to use the Bulk Insert DTS task. The DTS
Bulk Insert task gives you graphical interface. Check it in Books OnLine if
it suits you.

--
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com




Reply With Quote
  #3  
Old   
Nigel Rivett
 
Posts: n/a

Default RE: How to import fixed-width text file in MS SQL 2000? - 01-19-2005 , 08:09 PM



Bulk insert with a format file?
http://www.mindsdoor.net/SQLTsql/BCP...rmat_file.html

Bulk insert with a staging table?
http://www.mindsdoor.net/SQLTsql/ImportTextFiles.html

You can generate the format file for the first one or the inser statement in
the second from the structure of the destination table if you have set the
column sizes to match the file.

If you have a lot of different files consider holding the metadata in a table
http://www.mindsdoor.net/SQLTsql/MoveImportData.html


"Tom" wrote:

Quote:
Hello,

Is there a simple answer to this simple question?

How to import fixed-width text file?

I know the width of the columns but there are so many that I don't want
redefine them. I have already a table build for that data with the necessary
fields width. In dbase it was such a simple thing to do...

Note:
I went through the Import wizard in MS SQL 2000 and I could not find any
thing there about importing fixed-width text file.


Any help is greatly appreciated,
Les




Reply With Quote
  #4  
Old   
Sundeep
 
Posts: n/a

Default RE: How to import fixed-width text file(ragged right) in MS SQL 2005? C#.net handcode - 03-20-2009 , 08:10 AM



i don't want any wizard system plz.. ,file has to be imported by a user which has always same format so i need to do coding for that in C#.net(type of software)

no bulkinsert can't i have string to string copy


From http://www.developmentnow.com/g/98_2...S-SQL-2000.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/

Reply With Quote
  #5  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: How to import fixed-width text file(ragged right) in MS SQL 2005? C#.net handcode - 03-20-2009 , 11:01 AM



Sundeep,

There are many ways to skin a cat. One of them executing command-line BCP
utility (http://msdn.microsoft.com/en-us/library/ms162802.aspx) from .net.
This is the fastest. Another is reading a file line by line in .net, parsing
it by character positions and writing to a table. There is also SSIS
approach.

Ilya


"Sundeep" <nospam (AT) developmentnow (DOT) com> wrote

Quote:
i don't want any wizard system plz.. ,file has to be imported by a user
which has always same format so i need to do coding for that in C#.net(type
of software)

no bulkinsert can't i have string to string copy


From
http://www.developmentnow.com/g/98_2...S-SQL-2000.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.