Wednesday, 26 December 2012

The command for sql stored procedure execution in batch file.



sqlcmd -E -S serverName -d dbName /Q"exec SP_ExicutionSpName 'parm1','parm2'"

To turn on the sql component 'xp_cmdshell' if it is turned off



exec sp_configure 'show advanced options', 1;

RECONFIGURE;

exec sp_configure 'xp_cmdshell', 1;

RECONFIGURE

Exicute script file using batch file


sqlcmd -E -S serverName -d DatabaseName -i "Scriptfile_Path.sql"

Monday, 24 December 2012

If Database Mail XPs is off, the way to open the administrate of SQL

To open Database Mail XPs is the following way in the administrate of SQL

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Database Mail XPs', 1;
GO
RECONFIGURE
GO