all groups > sql server new users > july 2006 >
You're in the

sql server new users

group:

Import/Export issue


Import/Export issue mita
7/23/2006 8:16:01 PM
sql server new users: Hi guys
I am trying to import a text file into sql server but sql doesnt let me do
that.
My flat file is in the txt format.
Here is a part of my txt file

Indicatorid,IndicatorName,Reportingquarter,SourceDate,DHB,DHBName,PHO,PHOName,Practice,PracticeName,Practitioner,PractitionerName,NHI,DOB,Ethnicity_Group_1,Ethnicity_Group_2,Ethnicity_Group_3,Gender,Ageband,Quintile,Practice_Type,LabsPharms_rate,Population,Consults,DrZerorates,TotalProjPopn,ProjectedPopn,Adjustment,NumeratorSource,DenominatorSource,NumeratorCode,DenominatorCode,ReferralIDCRP,ReferralIDESR,Units,LOCUM,Percntge,Numerator,Denominator
19,GP Referred Pharmaceutical Expenditure Total Population,2005-10-01
00:00:00,2005-12-17 00:00:00,141,Southland DHB,600649,Wakatipu PHO
600649,600649_0001011,Queenstown Medical Centre,0037379,Simon Bernard
Davies,,,,,,,,,,,,,1.00,,,3.10,310.27000,.00000,,,,,,NO ,100.00,313.3727,.0000
19,GP Referred Pharmaceutical Expenditure Total Population,2005-10-01
00:00:00,2005-12-09 00:00:00,131,Otago DHB,597005,Central Otago PHO Ltd t/a
Rural Otago PHO 597005,597005_0000006,Aspiring Medical Centre,0037384,Jayne
Louise Davies,,,,,,,,,,,,,.80,,,1.52,189.47000,.00000,,,,,,NO
,100.00,190.9858,.0000
19,GP Referred Pharmaceutical Expenditure Total Population,2005-10-01
00:00:00,2005-10-05 00:00:00,120,Canterbury DHB,593879,Hurunui Kaikoura
Primary Health Organisation 59387,593879_0000002,Amuri,0031747,Jean Gerges
Dehn,,,,,,,,,,,,,1.10,,,2.61,474.56000,.00000,,,,,,NO ,50.00,239.8901,.0000
19,GP Referred Pharmaceutical Expenditure Total Population,2005-10-01
00:00:00,2005-11-16 00:00:00,120,Canterbury DHB,596721,Partnership Health
Canterbury 596721,596721_0003489,Darfield Medical Centre
Limited,0030500,Andries Hendrik
Grobler,,,,,,,,,,,,,1.10,,,2.04,185.33000,.00000,,,,,,NO
,100.00,187.3686,.0000








and this file is almost 1 gb in size.
when i try to export this file to sql 2005, it gives me an error which says
"invalid format"...
please help

Re: Import/Export issue Arnie Rowland
7/24/2006 8:22:18 AM
If importing similar files regularly, I recommend that you examine the
capabilities of DTS (for SQL 2000) or SSIS (for SQL 2005). Once you set up a
import 'routine', it can be saved and then the subsequent import will be
relatively 'painless'.

Good luck.

--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


[quoted text, click to view]

Re: Import/Export issue Keith Kratochvil
7/24/2006 9:10:12 AM
How are you trying to import the file?

You could use BCP or BULK INSERT.
You could also use DTS (or SSIS if you are running SQL Server 2005).
You might also be able to use a linked server (set up a linked server with
the text file driver).

Detailed information on the above topics can be found within Books Online.
http://msdn2.microsoft.com/en-us/library/ms379066.aspx

--
Keith Kratochvil


[quoted text, click to view]

Re: Import/Export issue mita
7/24/2006 1:16:01 PM
Thanks Arnie
I am not much familiar with DTs..could you give me some links or tutorials
so that i can work around??

cheers




[quoted text, click to view]
Re: Import/Export issue Arnie Rowland
7/24/2006 4:04:45 PM
Here's a website dedicated to DTS.

http://www.sqldts.com/?107

Also, don't forget to use Books on Line
Topics:
DTS Basics
Samples -there are several sample usages of DTS to view

And, of course, Microsoft's DTS support site.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dtssql/dts_basic_5zg3.asp

Good learning and good luck.

--
Arnie Rowland
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


[quoted text, click to view]

AddThis Social Bookmark Button