Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-06-24 : 01:19:58
|
| Russel writes "I need to do a bulk insert into an MS SQL table with out creating a file. I see from the MS SQL book online that Bulk Inserts can be performed from a file, but how do I do this from a variable? Writing a file on either the web or the SQL servers is out of the question.Russel" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-06-24 : 07:57:42
|
quote: Writing a file on either the web or the SQL servers is out of the question
Then there is no way to use BULK INSERT, or DTS, or bcp for that matter.You could try passing the data as a comma-separated value (CSV) into a stored procedure and parsing it, then inserting it. Take a look at these:http://www.sqlteam.com/SearchResults.asp?SearchTerms=csv |
 |
|
|
MakeYourDaddyProud
184 Posts |
Posted - 2002-06-24 : 08:06:54
|
| More clarification is required here. Where is your data coming from? Is it another database, Access, a file what? Also is the data held on another source such as a romote FS?Dan |
 |
|
|
rmadere
Starting Member
3 Posts |
Posted - 2002-06-24 : 08:54:03
|
quote: More clarification is required here. Where is your data coming from? Is it another database, Access, a file what? Also is the data held on another source such as a romote FS?Dan
Dan,The data will be coming from a submitted web form. There will be an arbitrary number of items to insert into the table.Russel |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-06-24 : 09:01:50
|
| Perfect! In addition to the CSV articles, take a look at these:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=12538http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=13935I've used CSV and fixed-length parameter passing for exactly the same situation you have, and they work very well indeed. |
 |
|
|
rmadere
Starting Member
3 Posts |
Posted - 2002-06-24 : 16:00:21
|
quote: Perfect! In addition to the CSV articles, take a look at these:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=12538http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=13935I've used CSV and fixed-length parameter passing for exactly the same situation you have, and they work very well indeed.
Thanks for pointing those out. My form is generating a list of lists. It comes in the form ProductID-SerialNumber,. Using the sp_ParseArray stored procedure, I think I can write one that will parse out the Model ID and Serial Number pairs and the parse the sublist and do my Insert (or Update).Am I completely off the wall here?RusselComing back to post after I test this bugger :) |
 |
|
|
rmadere
Starting Member
3 Posts |
Posted - 2002-06-24 : 16:38:07
|
quote: - snip -RusselComing back to post after I test this bugger :)
I tested it and it seems to work. Thanks. |
 |
|
|
|
|
|
|
|