| Author |
Topic  |
|
AskSQLTeam
Ask SQLTeam Question
USA
0 Posts |
|
|
Anonymous
Starting Member
0 Posts |
|
|
igor
Starting Member
0 Posts |
Posted - 04/16/2001 : 15:36:06
|
| Bulk Insert How about inserting file with none uniform delimiters. Is anything works short of using Format file. Example: "B",12454,"CAINE","TOOL",1989,"AK" "A",45896,"FURM","TOOL",2001,"FG" |
 |
|
|
Garth
SQLTeam Author
USA
119 Posts |
|
|
cs
Starting Member
1 Posts |
|
|
cs
Starting Member
1 Posts |
|
|
cs
Starting Member
1 Posts |
|
|
ppynrde
Starting Member
2 Posts |
Posted - 06/01/2001 : 10:23:21
|
Bulk insert
What is the best way of importing using the Bulk insert command if there is a comma between the text delimiters
eg. if one line is like:
"Edwards, Rich",1978,22
This is really bugging me so any help would be appreciated |
 |
|
|
robvolk
Most Valuable Yak
USA
15568 Posts |
Posted - 06/01/2001 : 10:41:07
|
quote:
Bulk insert
What is the best way of importing using the Bulk insert command if there is a comma between the text delimiters
eg. if one line is like:
"Edwards, Rich",1978,22
The best way is to not use a comma as a delimiter. Technically a delimiter is a character that is not data, at all, ever, so that any occurrence of the delimiter character can (and will) be discarded.
If you have commas in your data that you want to keep, use something else as a delimiter, like a tab, vertical pipe (|), or tilde (~).
I've had no problems with a tab-delimited, no quotes, carriage return/line feed text format. IMHO this is the best text format to use.
|
 |
|
|
ppynrde
Starting Member
2 Posts |
Posted - 06/01/2001 : 10:46:48
|
Thanks, but the problem is that .csv is how the data is exported to me . Is there anyway of using file format to get around this?
|
 |
|
|
robvolk
Most Valuable Yak
USA
15568 Posts |
Posted - 06/01/2001 : 11:45:50
|
You can import it into an Access database; Access handles quotes and embedded commas. You can then transfer it straight from Access or export it into a better text format.
Don't know if this is an option for you, but if someone sends me data in a format I can't use, I ask them to change formats. If they refuse, I let it be known that I can't do my job because the vendor/data provider isn't cooperating :) Unless they're using ancient software, it should be no problem for them to alter their format to your specs.
|
 |
|
|
phunkydude
Starting Member
Namibia
3 Posts |
Posted - 06/04/2001 : 14:31:33
|
quote:
You can import it into an Access database; Access handles quotes and embedded commas. You can then transfer it straight from Access or export it into a better text format.
Don't know if this is an option for you, but if someone sends me data in a format I can't use, I ask them to change formats. If they refuse, I let it be known that I can't do my job because the vendor/data provider isn't cooperating :) Unless they're using ancient software, it should be no problem for them to alter their format to your specs.
Another, maybe easier approach would be to massage the BULK INSERT format file. Try using 'native' DATAFILETYPE and changing the column definitions in the format file. |
 |
|
|
naveen
Starting Member
1 Posts |
Posted - 06/07/2001 : 03:53:46
|
How to skip the columns when loading the database using BULK INSERT?
i want to load only 3 columns out of 6 using BULK INSERT from a Text file
i am using SQL Server 7.0 |
 |
|
|
phunkydude
Starting Member
Namibia
3 Posts |
Posted - 06/07/2001 : 10:33:28
|
quote:
How to skip the columns when loading the database using BULK INSERT?
i want to load only 3 columns out of 6 using BULK INSERT from a Text file
i am using SQL Server 7.0
The format file defines the column mapping between the text file and the table. For each of the columns that do not exist in the table (or that you want to exclude from being imported), specify the SQL Server Table Column number to be zero.
|
 |
|
|
vkul
Starting Member
2 Posts |
Posted - 09/24/2001 : 17:26:48
|
Hi there
I have a CSV file with headers which has to be imported to MS SQL table. What options/command do I use with BCP to ignore the headers . Thank you
quote:
file header <P>I want to BULK INSERT a file into my database which has a first row in a different format than the rest of the file.
The problem is that I seem to have to put a blank row after the header row with the same format as the rest for the rest of the file to be inserted, otherwise BULK INSERT skips a row. BULK seems to be checking the format of the proceeding row when deciding if a row is to bee inserted or not. Is there an other way to go around this than putting a blank row after the header? Is it a bug or a feature?
/Kajsa
|
 |
|
|
robvolk
Most Valuable Yak
USA
15568 Posts |
Posted - 09/24/2001 : 17:39:51
|
You can add the -F (note the capital F) parameter to specify the first row that should be imported. -F2 would begin the import on line 2 (skipping line 1, in other words).
Books Online has all the documentation on the bcp utility.
|
 |
|
|
ddoremon
Starting Member
USA
1 Posts |
Posted - 02/05/2002 : 13:04:20
|
[quote] ASK CS Timeout - Part 3 I call a stored procedure from ASP. My Server.ScriptTimeout is default 90 sec. I testing ADO time out by Connection.CommandTimeout =1 Command.CommandTimeout = 1
But why my runrs is running until IIS time out... I think suppose ADO should be timeout first...That's what I want. Can you help me.
Thanks a bunch
|
 |
|
|
robvolk
Most Valuable Yak
USA
15568 Posts |
Posted - 02/06/2002 : 11:32:25
|
There's no reason to set CommandTimeout to 1 second, if anything that will aggravate any timeout problems you are having. Set them back to 30 or 60 seconds and see if the timeout goes away.
Are you using a loop with rs.MoveNext and response.Write within the loop? I guarantee that if you are, this is where your timeouts are occurring.
Take a look at these links:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=11019 http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=11833
I am a HUUUUUUUUUUUUUUUUUUUUUGE proponent of using GetString and GetRows in ASP pages. I heartily encourage you to play around and learn how to use them, it is probably the best way to create high-perfoming ASP pages that have heavy data requirements, and definitely worth your time. Follow all of the included links as well.
|
 |
|
|
Steve@CSC
Starting Member
6 Posts |
Posted - 07/29/2002 : 17:30:33
|
quote:
You can import it into an Access database; Access handles quotes and embedded commas. You can then transfer it straight from Access or export it into a better text format.
Don't know if this is an option for you, but if someone sends me data in a format I can't use, I ask them to change formats. If they refuse, I let it be known that I can't do my job because the vendor/data provider isn't cooperating :) Unless they're using ancient software, it should be no problem for them to alter their format to your specs.
I'm surprised that SQL Server doesn't handle this situation (importing a quoted text field w/ embedded comma) since BOTH MS Access & FoxPro do...I've got the same situation with limited options on input file format. Another shame is that MS won't break the 2GB/Table glass ceiling on VFP. If we're still forced to 'upsize' to SQL, at least this simple import functionality should be respected.
(Sorry for griping, but this is an old sore spot with me & MS...) |
 |
|
|
robvolk
Most Valuable Yak
USA
15568 Posts |
Posted - 07/29/2002 : 20:46:38
|
Actually, you can do it, Garth has an article demonstrating it:
http://www.sqlteam.com/item.asp?ItemID=3207
And DTS can handle quotes too.
As far as 2GB table limit, that must only be FoxPro, SQL Server can handle more. MS always seemed to treat FoxPro as a bastard child anyway; I got the impression that they only included it in VS 6.0 to keep vocal FP supporters from complaining. It was very obvious even back then that MS was gonna throw their chips into VB and VC++ exclusively...and they didn't even do that, they went .Net!
|
 |
|
|
Steve@CSC
Starting Member
6 Posts |
Posted - 07/30/2002 : 16:50:23
|
Thanks, but that wouldn't work in this case. Problem is that the comma field delimiter may be between nulls or numerics too, and the only time character input data HAS double-quotes surrounding it is when it contains an embedded comma.
Example: Line1,7,,Happy Days,Formica,ThisLineIsFine Line2,14,SomeText,Some More,"Twin, Evil",ThisLineChokesMeUp
|
 |
|
Topic  |
|