100 likes | 357 Views
-BCP JOB SCHEDULING- SQL SERVER MANAGEMENT STUDIO. -PRAJWAL -PRAMOD -KAVISH. CREATING NEW JOB. - Make sure that the SQL SERVER AGENT is started - Right click on jobs, select new job. Defining the Job .
E N D
-BCP JOB SCHEDULING-SQL SERVER MANAGEMENT STUDIO -PRAJWAL -PRAMOD -KAVISH
CREATING NEW JOB - Make sure that the SQL SERVER AGENT is started - Right click on jobs, select new job
Defining the Job • Give an appropriate name and description to the job
Creating the steps • On Select a Page section, Click STEPS and click on the NEW button
Setting the Job step properties • Select type as TRANSACT –SQL SCRIPT (T-SQL) • Type the steps in COMMAND
BCP SCRIPT using xp_cmdshell (COMMAND) exec sp_configure 'show advanced options',1 go reconfigure go exec sp_configure 'xp_cmdshell',1 go reconfigure go declare @command nvarchar(4000), @command1 nvarchar(4000), @command2 nvarchar(4000) set @command=‘ bcp AdventureWorks.person.address out C:\backup\b.txt -c -S INFCH02817 -U kavish -P kavish' set @command1='b cp AdventureWorks.HumanResources.EmployeeAddress out C:\backup\b1.txt -c -S INFCH02817 -U kavish -P kavish' set @command2=‘ bcp AdventureWorks.HumanResources.Department out C:\backup\b2.txt -c -S INFCH02817 -U kavish -P kavish' exec xp_cmdshell @command exec xp_cmdshell @command1 exec xp_cmdshell @command2 go
SCHEDULING THE JOB • Specify the NAME and SCHEDULE TYPEand schedule the job as required