How to connect to database from a BAT file and execute stored procedure

I am new to MSSQl, and here is what I need help with. I ned to do all the following form a BAT file.
1- connect to a database

2-load a datase table from a XLS file

3- run a stored procedure to populate a table

4- download the table into a CVS file onto a server in a specific directory.

Any help would be appreciated. Thanks in advance

Welcome jkeri

So why do you want to load xls and export as csv and involve sql server with it? You can do this via script like powershell

I do not have those tools here. I am limited to SQL seRVER FUNCTIONALITY

Do you have access to SSIS (SQL Server Integration Services)? Everything you describe can be done with SSIS.


please see if the below link helps !!!