ALTER PROCEDURE [dbo].[AmendInsertDuplicateFields] (@ReportID varchar(50))
AS
BEGIN
DECLARE @NewReportID VARCHAR(50)
SET @NewReportID = NEWID()
INSERT INTO [MVCOmar].[dbo].[PrideMVCCollisionBegin]
([ReportID], [LocalIncidentNum], [version], [MTOReferenceNo], [Submitted])
SELECT
@NewReportID, [LocalIncidentNum], [version], [MTOReferenceNo], [Submitted]
FROM
[MVCOmar].[dbo].[PrideMVCCollisionBegin]
WHERE
[ReportID] = @ReportID;
I would like to take the result that I get for version, convert it from string to int type, add one, convert back to string, and store it.
I acknowledge that version should be int and not string type. I also acknowledge that an even better method of accomplishing this would be to set properties to increment by one.
I can’t do either of those option for the time being because my priorities are different right now, I am time limited, the code is very old, and written by numerous people which carried poor coding habits.
you don’t need to convert it, run this, there will be an implicit conversion
That returns 2
In your case you can just do
[version] + 1