I have a CSV file that I need to import into 2005.
Here’s a sample of my data:
Expires,BName,Applied
9/11/2011,SANDY'S GIFTS,1/30/2004
9/11/2011,"LEO J TRUMBLE, III",12/3/1999
9/8/2011,S & S EQUIPMENT,7/4/1999
9/7/2011,JACKSTAR CO., 11/27/1996
9/11/2011,WALKER'S METAL ART,4/6/2001
The data is nicely formatted for us. When (and only when) a BName has a comma in it, the entire BName is surrounded by quotes. For example “LEO J TRUMBLE, III”
I've looked around the forum and since I’m a SQL newbie, I’ve learned a lot, but I’m still hitting a wall.
I can use the SQL Server Import and Export Wizard and that works fine with my csv file (I use " for my Text Qualifier).
From here I thought to use the package built by the Wizard for SSIS. Digging deeper, it is suggested that SSIS not be installed on the SQL server and since this is our stand alone web server, setting up a new workgroup, server, install SSIS, etc. just seems over kill. I’m sure it would be a blast to do all of this; I just don’t have the time.
MS says DTS is being phased out so I didn't even start down that road.
So then I found mention of a bulk insert and I thought OK—I’ll get that to work and then I’ll get it to automate in some kind of job. When I do a bulk install in MS SQL Server Management Studio, I run into an issue with commas within fields.
Here is my bulk insert:
BULK INSERT dbo.DBA
FROM 'C:\database\dbasample.csv'
WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n')
GO
The III in the name “LEO J TRUMBLE, III” is inserted into the Applied column.
Again, I’m not a SQL guru/programmer so if you have suggestions for scripts, a lot of hand holding will be appreciated.
Here’s a sample of my data:
Expires,BName,Applied
9/11/2011,SANDY'S GIFTS,1/30/2004
9/11/2011,"LEO J TRUMBLE, III",12/3/1999
9/8/2011,S & S EQUIPMENT,7/4/1999
9/7/2011,JACKSTAR CO., 11/27/1996
9/11/2011,WALKER'S METAL ART,4/6/2001
The data is nicely formatted for us. When (and only when) a BName has a comma in it, the entire BName is surrounded by quotes. For example “LEO J TRUMBLE, III”
I've looked around the forum and since I’m a SQL newbie, I’ve learned a lot, but I’m still hitting a wall.
I can use the SQL Server Import and Export Wizard and that works fine with my csv file (I use " for my Text Qualifier).
From here I thought to use the package built by the Wizard for SSIS. Digging deeper, it is suggested that SSIS not be installed on the SQL server and since this is our stand alone web server, setting up a new workgroup, server, install SSIS, etc. just seems over kill. I’m sure it would be a blast to do all of this; I just don’t have the time.
MS says DTS is being phased out so I didn't even start down that road.
So then I found mention of a bulk insert and I thought OK—I’ll get that to work and then I’ll get it to automate in some kind of job. When I do a bulk install in MS SQL Server Management Studio, I run into an issue with commas within fields.
Here is my bulk insert:
BULK INSERT dbo.DBA
FROM 'C:\database\dbasample.csv'
WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n')
GO
The III in the name “LEO J TRUMBLE, III” is inserted into the Applied column.
Again, I’m not a SQL guru/programmer so if you have suggestions for scripts, a lot of hand holding will be appreciated.