September 30, 2009 at 8:43 am
I am getting very frustrated trying to resolve all of the "issues" with Openrowset, Bulk Insert and MDSASQL etc. All I need to do is to import all of the information in a CSV that resides on the C: of the SQL2005 Server in question into a database.table on the same SQL2005 server. At this point I just need a concise solution.
September 30, 2009 at 8:59 am
The easiest way is to right click on the database then click on Tasks.. then Import data.. and then follow the wizard..
September 30, 2009 at 11:49 am
Please excuse me, but I meant to mention that I am trying to do this from a stored procedure. This is to be part of web application where the user won't have any access to the servers.
September 30, 2009 at 11:54 am
In my experience, OpenRowset is the easiest way to do that.
What issues are you having with that?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
September 30, 2009 at 1:56 pm
Ironically, I have continued working on the issue and made a couple of tweeks and got it to work. But to answer you question my original code was:
INSERT INTO ExistingTableName
SELECT * FROM OPENROWSET('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)}','SELECT * FROM C:\Temp\DummyCSVFile.csv')
The result from this was an error because the Linked server was null.
However the new code, which at this point in testing is working perfectly is:
SELECT * INTO NewTableName FROM OPENROWSET('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)}','SELECT * FROM C:\Temp\DummyCSVFile.csv')
I will continue working away until I am sure everything works. Thanks to everyone being available.:-)
September 30, 2009 at 7:34 pm
Berl -384058 (9/30/2009)
Ironically, I have continued working on the issue and made a couple of tweeks and got it to work. But to answer you question my original code was:INSERT INTO ExistingTableName
SELECT * FROM OPENROWSET('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)}','SELECT * FROM C:\Temp\DummyCSVFile.csv')
The result from this was an error because the Linked server was null.
However the new code, which at this point in testing is working perfectly is:
SELECT * INTO NewTableName FROM OPENROWSET('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)}','SELECT * FROM C:\Temp\DummyCSVFile.csv')
I will continue working away until I am sure everything works. Thanks to everyone being available.:-)
What do you meant the "Linked server was null"? I see no difference between the two OPENROWSET commands and neither makes reference to a linked server.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply