Delete a SQL table from a DOS command

My problem

I have a BCP command, which allows me to export a table to a .TXT file, I need to clear the table just after export

can I delete a SQL table from a DOS command

thanks

You can use SQLCMD. There are some examples here.

Thank you JamesK

I can not, can you help me:
1 / connect to the server (instance)
2 / use my database
3 / execute my query or my procedure

thank you

Since I don't know the details of your database server, whatever I say is not going to be any better than what they have shown in that example. Were you able to open the link and looka t the example?

Assuming you are using integrated security, and that your servername is MyServer and that it is the default instance and that your database name is MyDatabase, and that your stored procedure name is MyStoredProc, what you would do is to run a command such as this from your command window

sqlcmd -S MyServer -d MyDatabase -Q "EXEC dbo.MyStoredProc"

thanks it is ok

If the table doesn't have Foreign Key constraints etc. then you could use

TRUNCATE TABLE MyTable

otherwise you will have to use

DELETE MyTable

The TRUNCATE TABLE is much more efficient, and uses very little log file space (whereas DELETE will log every row deleted)

Take a backup first!!