Stored Procedure Compare
Has anyone seen this:
I have about 30 stored procedures that continually keep showing up as out of sync with my source database. When lookinf at the compare windows (source and target), the Schema Compare engine is putting in a bunch of white space in the target stored procedure script and deeeming that as not being the same as the target.
If I script the same stored procedures in SSMS - or any other SQL editor for that matter - the two scripts are identical...no extra white space, anything...
Whenever I choose to "Writre Updates", nothing happens - the stored procedure never "syncs" up. I'll include an example. Here is the source stored procedure:
-- Stored procedure
-- =============================================
-- Author:Scott Clements
-- Create date: 07/16/2007
-- Description: Account SELECT
-- =============================================
CREATE PROCEDURE[dbo].[p_Account_Select]
@AccountIdInt=Null
AS
BEGIN
-- Set System OptionsSET NOCOUNT ONSETANSI_NULLSOFFSETANSI_WARNINGSOFFDECLARE@AcctIdVarChar(10)-- Populate Character values for possible error reportingSELECT@AcctId =Convert(VarChar(10),@AccountId)IF NOT EXISTS(SELECT*FROMAccount (NOLOCK)WHEREAccountId = @AccountId)AND@AccountIdIS NOT NULLBEGINRAISERROR(50334, 11, 1, 50334, @AcctId)Return-1ENDSELECTAC.AccountId
, AC.AcctTypeEnumItemId
, AC.Description
, AC.AccountProviderTypeEnumItemId
, AC.ExternalAccountId
, AC.RoutingInfo
, AC.SeedPaymentId
, AC.CreateDate
, AC.CreateId
, AC.ModifiedDate
, AC.ModifiedId
,
Count(DISTINCTD.DistributionId)ASNumberOfDistributions,
Count(P.PaymentId)ASNumberOfPaymentsFROMAccount AC (NOLOCK)LEFT OUTER JOINDistribution DOND.AccountId = AC.AccountIdLEFT OUTER JOINPayment POND.DistributionId = P.DistributionIdWHEREAC.AccountId =CASE WHEN@AccountIdIS NULL THENAC.AccountId
ELSE@AccountIdENDGROUP BYAC.AccountId
, AC.AcctTypeEnumItemId
, AC.Description
, AC.AccountProviderTypeEnumItemId
, AC.ExternalAccountId
, AC.RoutingInfo
, AC.SeedPaymentId
, AC.CreateDate
, AC.CreateId
, AC.ModifiedDate
, AC.ModifiedId
END
Here is the target procedure, as interpreted by the Schema Compare (right window):
-- Stored procedure
-- =============================================
-- Author:Scott Clements
-- Create date: 07/16/2007
-- Description: Account SELECT
-- =============================================
CREATE PROCEDURE[dbo].[p_Account_Select]
@AccountIdInt=Null
AS
BEGIN
-- Set System OptionsSET NOCOUNT ONSETANSI_NULLSOFFSETANSI_WARNINGSOFF DECLARE@AcctIdVarChar(10)-- Populate Character values for possible error reportingSELECT@AcctId =Convert(VarChar(10),@AccountId)IF NOT EXISTS(SELECT*FROMAccount (NOLOCK)WHEREAccountId = @AccountId)AND@AccountIdIS NOT NULLBEGINRAISERROR(50334, 11, 1, 50334, @AcctId)Return-1ENDSELECTAC.AccountId
, AC.AcctTypeEnumItemId
, AC.Description
, AC.AccountProviderTypeEnumItemId
, AC.ExternalAccountId
, AC.RoutingInfo
, AC.SeedPaymentId
, AC.CreateDate
, AC.CreateId
, AC.ModifiedDate
, AC.ModifiedId
,
Count(DISTINCTD.DistributionId)ASNumberOfDistributions,
Count(P.PaymentId)ASNumberOfPaymentsFROMAccount AC (NOLOCK)LEFT OUTER JOINDistribution DOND.AccountId = AC.AccountIdLEFT OUTER JOINPayment POND.DistributionId = P.DistributionIdWHEREAC.AccountId =CASE WHEN@AccountIdIS NULL THENAC.AccountId
ELSE@AccountIdENDGROUP BYAC.AccountId
, AC.AcctTypeEnumItemId
, AC.Description
, AC.AccountProviderTypeEnumItemId
, AC.ExternalAccountId
, AC.RoutingInfo
, AC.SeedPaymentId
, AC.CreateDate
, AC.CreateId
, AC.ModifiedDate
, AC.ModifiedId
END
GO

