Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Importing Data (SQL Server)
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Importing Data (SQL Server)

 Post Reply Post Reply
Author
Gary View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 March 2002
Location: United Kingdom
Status: Offline
Points: 326
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gary Quote  Post ReplyReply Direct Link To This Post Topic: Importing Data (SQL Server)
    Posted: 06 May 2003 at 8:37am

Ok, I've been working with SQL Server for a few years, but am compltetely stumped by this one....

Basically I have a csv file which comprises of a header, column names followed by column data as follows

"Created at ","6-May-2003 13:54:10","GMT" (FILE HEADER)
"Mgr1 Name","Mgr2 Name","Mgr3 Name","SE Name","SE_USER_ID","OPP_NO","SE_COUNTRY","SITE_ID","SITE_NAME","FRCST_CLOSE_DT","FRCST_PROD_REV","FRCST_SERV_REV","FRCST_ED_REV","CURRENCY_CD","PROB_CLOSE_PCT","STATUS_CD","TOP_DEAL_IND","TAS_PLAN_IND","PROB_WIN_PCT","MF_OPP_IND","OPP_SUMMARY_TXT","BLANK","TOPS_NAME","ADDRESS_1","ADDRESS_2","CITY","STATE","ZIP","COUNTRY","PERIL_IND","INSIDE_QTR_IND","E_BUSINESS","ENTERPRISE_MGMT","TEMP","OS390","PORTAL_MGMT","PREDICITIVE_ANAL","SECURITY","STORAGE","TIME","TIMECAP","VSE_VM","Mgr1ID","Mgr2ID","Mgr3ID","Row#","Mgr4 Name","Mgr4ID" (COLUMN NAMES)
"mgr1 data","mgr2 data","Mgr3 data","SE data", and so on (DATA)
"mgr1 data","mgr2 data","Mgr3 data","SE data", and so on (DATA)
"mgr1 data","mgr2 data","Mgr3 data","SE data", and so on (DATA)

Now, I just cannot get the damn data to import (using DTS) - it complains of too many columns being found in the current row. I've tried setting up the data transformation to skip x number of rows, first row has column names, etc, but no luck.

If I manually remove the first row (Created at......) and then import it works fine.

So, what do I need to do? I really could do without any manual intervention (ie modifying the source file).

Thx

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2003 at 12:55pm

over the years i have noticed that Access is better at importing data like this

perhaps try to import that list into Access (or Excel) and then into SQL ?

i dunno, just a thought to try to help ya out

Contribute to the working anarchy we fondly call the Internet
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 2003 at 1:53pm
Well when importing the data you should not have the header in there because it bombs the format. For importing csv files though i like to use the bcp utility or BULK INSERT, which gives you some nicer options...
Back to Top
Gary View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 March 2002
Location: United Kingdom
Status: Offline
Points: 326
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gary Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2003 at 2:38am

Thanks for the responses....

Morningz,
I wish I could get the file without the header information, but it comes from our head office and they're not exactly helpful on the matter!!!!

Michael,
I was thinking of looking at BCP, but have never used it before.

One workaround I've been playing with is to use fso to read the data, line by line and then import only the lines/rows required into SQL (not all of the data below the header is required).

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.