September 15, 2008 at 1:12 pm
hi
I have a table whit 3 columns and i need to do a bulk insert from a Archive.Dat but this archive it only have one column to insert. (I have all ready the format file )
the Archive.dat file file have this data.
0003423
0004849
0004117
0001771
0001601
0001602
0001533
0003546
0006108
The query of the bulk insert its like this
BULK INSERT IngresoLector
FROM 'C:\Archive.dat'
WITH (FORMATFILE = 'C:\IngresoLector.Fmt');
It works whit some thing like this:
,0003423,
,0004849,
,0004117,
,0001771,
,0001601,
,0001602,
but the archive doesnt have the "," and is an archive of hundreds of codes that i need to put in sql Server 2005.
Thank you for any help whit this.
September 15, 2008 at 1:23 pm
Is this a one-time import or something you will be doing over and over again?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
September 15, 2008 at 2:37 pm
i need to do that over and over again.
September 15, 2008 at 3:15 pm
This seems to work for me:
Create View vwIngresoLector_Import
as
Select ImportColumn from IngresoLector
GO
BULK INSERT vwIngresoLector_Import FROM 'C:\Archive.dat'
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
September 15, 2008 at 3:29 pm
thank you rbarryyoung, it works for me too
September 15, 2008 at 3:55 pm
Glad I could help.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply