473,486 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

import text file in sql 2005

43 New Member
i have a text file. I want to import it in table in sql 2005.that table has 8 fields.whn importing text file first 4 fields are in first line and next 2 in 2nd and rest 2 in last line. I want all 8 fields in one line. plz guide.
Dec 1 '08 #1
2 2617
myct
4 New Member
Since you are using SQL 2005, once way (where you would have more control over the import) is to use write a CLR stored procedure, that will read the file using a StreamReader that loops through the file and treats each 3 lines (and multiples thereof) as a single record and inserts into the table.
If you go this way, remember you can use Context Connection = True to refer to the database that you are calling to CLR SP from...

Hope this helps
-Shiva
mycodetrip.com
Dec 1 '08 #2
ck9663
2,878 Recognized Expert Specialist
What's the text file type? Delimited? Fixed?

-- CK
Dec 2 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2674
by: jean.rossier | last post by:
Hello All, I am facing a problem while importing pylab library(in a .py program file) via web browser however the same program works when I execute it from the command prompt. my...
3
2130
by: Joost | last post by:
Hello, I am using the LOAD DATA INFILE command to import a text file into mysql. However, there is much more text in the file than needed in my tables. How can I make a selection from the...
2
3048
by: David Berry | last post by:
Hi All. I'm looking for any help or sample code that can show me how to make a file import wizard in ASP.NET (VB preferred) like the one that MS Access uses. I'm working on a web site where the...
1
2818
by: Shaun Harwood | last post by:
Hello all Here is a puzzle I hope someone has a solution for. I am trying to import a delimited text file using a Visual Basic 'TransferText' command. So that the table is created properly I...
2
11042
by: musicloverlch | last post by:
I need to import 60 text files all in one folder. Can I use VBA to cycle through all the files, without having to import them one by one? Does anyone have an example? Thanks in advance. Laura
3
2619
by: cbanks | last post by:
I would appreciate some help on a procedure that I have. Using Bulk Insert, I would like to import records from a text file. The issue I have is the file contains a header - '1AMC_TO_Axiz' and a...
10
2077
by: Avi | last post by:
Hi I need to read in a large set of text files (9GB+ each) into a database table based on fixed width lengths. There are several ways to complete this, but I am wondering if anyone has...
3
3212
by: Davy B | last post by:
I am trying to import a data file, which is tab delimited, using BULK INSERT. I have used BCP to create a format file, since the destination table has around 20 columns, but the data file has only...
6
9962
by: EricR | last post by:
I am trying to bcp import a text file into a SQL Server 2000 database. The text file is coming out of a java application where order information is written to the text file. Each record is on it's...
9
21799
by: cabrenner | last post by:
I am new to SQL Server, and migrating part of an Access application to SSE. I am trying to insert a comma delimited file into SSE 2005. I am able to run a BULK INSERT statement on a simple file,...
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7319
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.