Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Server insert statement runs successfully but values are not added to table even though row is created
    text
    copied!<p>I have an insert statement as below. I am able to debug my stored procedure and step through my code to verify that my code runs, but a funny thing happens. </p> <p>The values that I expect to be saved in the database are not saved. Instead a row is created in the table and the <code>RecordCreatedField</code> is correctly created, even a primary key is included but the actual columns I expect to be inserted are not. All the columns are <code>nvarchar/varchar</code>, except for the date columns and the ID, but only those columns are populated. However the following <strong>@PRCUPC ,@PRCEAN ,@PRCGTIN,@PRCatalogNumber</strong> are somehow omitted. </p> <pre><code>EXEC spinsertprodcode @pid out, @ProdID, @UPC, @EAN, @TIN, @CNumber, 0, 0, 1, @staid, @counter out INSERT INTO dbo.ProdCodes (PRProductID ,PRCUPC ,PRCEAN ,PRCGTIN ,PRCatalogNumber ,PRIsReplacement ,PRIsReplaced ,PRCRecordCreatedDate ,PRCIsActive ,PRStatusFlag) OUTPUT INSERTED.PRCID INTO @opID VALUES (@PRProductID, @PRCUPC, @PRCEAN, @PRCGTIN, @PRCatalogNumber, @PRIsReplacement , @PRIsReplaced, GETDATE(), @PRCIsActive, @PRStatusFlag) SELECT @PRCID = O.ID FROm @opID O </code></pre> <p>Would appreciate any suggestion on how I can fix this or understand what is going on. </p> <p><img src="https://i.stack.imgur.com/9cJ6p.png" alt="Image of the Debug Screen where I confirm the right values are passed"></p> <p>Here is an SQl fiddle of the main Stored proc that calls my insert code. <a href="http://sqlfiddle.com/#!6/d41d8/9" rel="nofollow noreferrer"><strong>SQL Fiddle of my code</strong> </a></p>
 

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