How I can delete data from SQL Server table using batch.
I'm using SQL Server 2008 R2.
How I can delete data from SQL Server table using batch.
I'm using SQL Server 2008 R2.
Do you mean configuring your sql script as batch job? if yes, then write your sql query in a script like
Filename: sqldelete.sql
delete from my_table where <some condition>;
GO
Create a batch file .bat
and call your sql script in there like
sqlcmd -s <server name> -d <db name> -i sqldelete.sql
For more options on sqlcmd
: run command sqlcmd /?
in command prompt
Configure this .bat
file to run in schedule as per your need
If you want to know how to schedule task in windows task scheduler then take a look @ http://support.microsoft.com/kb/308569 (This is for WINXP).