Reputation: 3168
I have csv file with column: id,name,value
I need to write simple Test.bat file (windows batch file), where I put:
server name, database, table, user and pass
and script will insert all *.csv data to my db. (something similar to SQL loader)
Upvotes: 0
Views: 3343
Reputation: 3168
ok,
by user I mean people from my team, but with are using Windows Authentication....
do you recomend to use other tools?
I have already wrote vba code to upload data(conn.Execute "insert.....), but it's not so fast as BCP. Maybe if you have other examples as better solution please share
Upvotes: 0
Reputation: 67291
ad BCP:
There is no system built in tool which is there by any means. But I think BCP is installed together with the SQL Server - probably not for all client's machines...
ad security:
One problem with a BCP call within a BAT-file is security... Be aware that everybody who can reach your BAT-File finds the full connection string in it. Everybody could introduce any SQL cmd from there...
ad own application
It might be easier and better in this point of view to write a tiny application in the coding laguage you like most, which does what you want. Thus it's on you to make sure, that this app exists on your client's machines. Such an app allows you to do side work like tracing a log file, show "real" error messages or do some kind of user's right management.
Upvotes: 1