Stored procedure - update tables in 2 databases

  • I have to update 2 databases at once from a stored procedure. How can this be done? This is what I have so far. I get an error:

    The multi-part identifier "magicCRM.dbo.courseScheduleID" could not be bound.

    alter PROCEDURE [dbo].[usp_increment_registered] --usp_increment_registered 3128

    -- Add the parameters for the stored procedure here

    @courseScheduleID int

    AS

    BEGIN

    -- SET NOCOUNT ON added to prevent extra result sets from

    -- interfering with SELECT statements.

    SET NOCOUNT ON;

    -- Update magicCRM_Web Table

    UPDATE Course_Schedule

    SET [Alternate_LocationID] = Alternate_LocationID + 1

    WHERE courseScheduleID = @courseScheduleID

    --update magicCRM Table

    UPDATE [magicCRM].[dbo].[Course_Schedule]

    SET magicCRM.dbo.[Alternate_LocationID] = magicCRM.dbo.Alternate_LocationID + 1

    WHERE magicCRM.dbo.courseScheduleID = @courseScheduleID

    END

    Thank you!

    Norbert

  • Hi,

    Looks like you are missing a field here...

    Here is the syntax... Please review again.

    [Database].[dbo].[Table].[Fields]

    Hope this helps... Koncentrix

    Koncentrix

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply