Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding rowguid column broke this Stored Procedure?
    primarykey
    data
    text
    <p>I have added a bounty to this as I have, as yet been able to figure this out and time is out. </p> <hr> <p>The below stored procedure will not allow me to add it to Modify it. When attempting to modify it I get the following error --> </p> <p><code>Msg 213, Level 16, State 1, Procedure spPersonRelationshipAddOpposing, Line 51 Insert Error: Column name or number of supplied values does not match table definition.</code> </p> <p>Also, Since the DB was set up for Merge Rep (a rowguid column has been added) this stored procedure now no longer works properly.</p> <p>Do I need to chang the way the columns are listed? One of the warnings when setting up Merge Rep was this --> </p> <p><code>Adding Guid Column MAY Cause INSERT Statements without column lists to Fail</code></p> <p>What does that mean? Ideas on how I fix this? </p> <pre><code>USE [Connect] GO /****** Object: StoredProcedure [dbo].[spPersonRelationshipAddOpposing] Script Date: 07/15/2009 08:14:35 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[spPersonRelationshipAddOpposing] @ExistingRelationshipID INT AS BEGIN --Declare local variables DECLARE @PersonID INT --PersonID of established relarionship DECLARE @RelatedID INT --RelatedID of established relarionship DECLARE @Relationship VARCHAR(4) --Established relarionship DECLARE @RelatedSex as VARCHAR(1) DECLARE @OpposingRelationship VARCHAR(4) DECLARE @OpposingRelationshipID INT --Fill variables from existing relationship SELECT @PersonID = PersonID, @RelatedID = RelatedID, @Relationship=PersonRelationshipTypeID FROM tblPersonRelationship where PersonRelationshipID = @ExistingRelationshipID --Get gender of relative for finding opposing relationship type SELECT @RelatedSex = (SELECT Gender FROM tblPerson WHERE PersonID = @PersonID) --get opposing relationship types IF (@RelatedSex='M') BEGIN SELECT @OpposingRelationship = (SELECT OpposingMaleRelationship From tblAdminPersonRelationshipType WHERE PersonRelationshipTypeID = @Relationship) END ELSE IF (@RelatedSex='F') BEGIN SELECT @OpposingRelationship = (SELECT OpposingFemaleRelationship From tblAdminPersonRelationshipType WHERE PersonRelationshipTypeID = @Relationship) END --check for existing opposing relationship SELECT @OpposingRelationshipID = (SELECT MAX(PersonRelationshipID) FROM tblPersonRelationship WHERE PersonID = @RelatedID AND RelatedID = @PersonID) --if an opposing relationship was found IF (@OpposingRelationship IS NOT NULL) BEGIN --if there is a relationship, update it IF ISNUMERIC(@OpposingRelationshipID)=1 BEGIN UPDATE tblPersonRelationship SET PersonRelationshipTypeID = @OpposingRelationship, MarriageDate = (SELECT MarriageDate FROM tblPersonRelationship WHERE PersonRelationshipID = @ExistingRelationshipID), ResidesWithPersonFlag = (SELECT ResidesWithPersonFlag FROM tblPersonRelationship WHERE PersonRelationshipID = @ExistingRelationshipID), UpdateDateTime = (SELECT UpdateDateTime FROM tblPersonRelationship WHERE PersonRelationshipID = @ExistingRelationshipID), UpdateProgram = (SELECT UpdateProgram FROM tblPersonRelationship WHERE PersonRelationshipID = @ExistingRelationshipID), UpdateUserID = (SELECT UpdateUserID FROM tblPersonRelationship WHERE PersonRelationshipID = @ExistingRelationshipID) WHERE PersonRelationshipID = @OpposingRelationshipID END --otherwise add record ELSE IF (@OpposingRelationship IS NOT NULL) BEGIN INSERT INTO tblPersonRelationship SELECT @RelatedID, @OpposingRelationship, @PersonID, MarriageDate, NULL, NULL, ResidesWithPersonFlag, NULL, UpdateDateTime, UpdateProgram, UpdateUserID, UpdateDateTime, UpdateProgram, UpdateUserID, NULL FROM tblPersonRelationship WHERE PersonRelationshipID = @ExistingRelationshipID END END END </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload