I have done this in the past, but have forgotten how to save the Stored Procedure to make it Run like it does when you comment out the 'Create' portion of the Procedure, and uncomment the 'Begin' and 'End'. When I save it like that, it just changes 'Create' to 'Alter' and does not run in the Scheduled Job. What am I missing? What are the steps to creating a Stored Procedure? Here is what I have done to create mine:
CREATE PROCEDURE [dbo].[UpdateWSDCustomer]
@SAMPNAME nvarchar(254) = ''
set nocount on
SET SAMPNAME = ...
Then after I have all of my queries in place and have Run it to Create the Stored Procedure, I place Comment markers before 'Create' and after 'set nocount on'. Then I remove the comments from the 'Begin' and 'End' and run it to make sure I get the output I am expecting. Then I save the Stored Procedure, thinking that it will save it with the 'Begin' and 'End' uncommented, and ready to Run... but it does not. It just changes the 'Create' to 'Alter' and comments out the 'Start' and 'End', and that fails when I try to run it in a job.
I have a database that gets updated every 4 hours and then I have Stored Procedures that run immediately after to correct any incorrectly formatted data. But what is the process that I am missing to Save this Stored Procedure with the 'Start' and 'End' uncommented so that the Procedure will run?