Search code examples
sql-servermicrosoft-dynamicsdynamics-crm-365bacpac

Procedure FINTAG_INSTEADOFINSERTTRIGGER, Line 41 Cannot insert an explicit value into a timestamp column


I encountered the following error while attempting to restore the 10.0.40 UAT.bacpac on a development environment running version 10.0.38:

Procedure FINTAG_INSTEADOFINSERTTRIGGER, Line 41 Cannot insert an explicit value into a timestamp column.

Has anyone else experienced this issue and found a resolution from Microsoft Support?

Error SQL72014: Core Microsoft SqlClient Data Provider: Msg 273, Level 16, State 1, Procedure FINTAG_INSTEADOFINSERTTRIGGER, Line 41 Cannot insert an 
explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column.
Error SQL72045: Script execution error.  The executed script:
CREATE TRIGGER [dbo].[FINTAG_INSTEADOFINSERTTRIGGER]
    ON [dbo].FinTag
    INSTEAD OF INSERT
    AS BEGIN
           DECLARE @ErrorLevel AS INT = 0;
           DECLARE @Delimiter AS CHAR;
           DECLARE @IsDelimiterInValues AS BIT;
           DECLARE @ErrorDelimiter AS CHAR = '!';
           SELECT @Delimiter = CASE (SELECT DELIMITER
                                     FROM   FINTAGPARAMETERS
                                     WHERE  PARTITION = (SELECT PARTITION
                                                         FROM   INSERTED)) WHEN 1 THEN '|' WHEN 2 THEN '.' WHEN 3 THEN '_' WHEN 4 THEN '-' WHEN 5 THEN 
'~' ELSE @ErrorDelimiter END;
           SELECT @IsDelimiterInValues = CASE WHEN CHARINDEX(@Delimiter, concat(TAG01, TAG02, TAG03, TAG04, TAG05, TAG06, TAG07, TAG08, TAG09, TAG10, 
TAG11, TAG12, TAG13, TAG14, TAG15, TAG16, TAG17, TAG18, TAG19, TAG20)) > 0 THEN 1 ELSE 0 END
           FROM   inserted;
           DECLARE @Hash AS NVARCHAR (64);
           DECLARE @DisplayValue AS N
Time elapsed 1:14:17.66

This error occurred approximately one hour after starting the script.

C:\sqlpackage-win-x64-en-162.3.566.1> ./SqlPackage.exe /a:import /sf:C:\Backup\dbbackup.bacpac /tsn:localhost /tdn:AxDB2 /ttsc:true /p:CommandTimeout=1200

I have searched online for solutions, but none have worked. I also updated the local environment to the latest version without success.


Solution

  • I have solved this issue by following these steps:

    1. Download the latest binary from LCS and update it on the local VM.
    2. Follow the steps from this link. this link
    • Go to Feature Management and turn on the Financial Tags feature.
    • Go to the Data maintenance portal and click /Check for updates/.
    • Run the /Deploy financial tag table triggers/ data maintenance job

    When the job finishes successfully, you can take a new export database and then try to load that one into the development environment.