i had query for update the version of my value, here the code
DECLARE @inParam AS VARCHAR(50) = '80003689_CST_20120118'
DECLARE @file_extension varchar(50)='.xlsx'
DECLARE @lastVer AS VARCHAR(50)
DECLARE @nextVer AS INT
DECLARE @combine AS VARCHAR(50)
SELECT @lastVer = MAX([File_Name])
FROM dbo.Uploaded_File
WHERE [File_Name] LIKE @inParam+'%'
SELECT @nextVer = CAST(SUBSTRING(@lastVer,LEN(@inParam) + 6, 1) AS INT) + 1
SELECT @combine = @inParam + '(' + CONVERT(VARCHAR, @nextVer) + ')' + @file_extension
SELECT @lastVer, @nextVer, @combine
the problem is when the value 80003689_CST_20120118(1), its not updated the version, the result i had 80003689_CST_20120118(1)(1)…
but i wanted the result become 80003689_CST_20120118(2).
so if i had same value it will become :
80003689_CST_20120118
80003689_CST_20120118(1)
80003689_CST_20120118(2)
etc
Answered by @Dimitri..
but i can’t mark his answered.. its givin error page on me…
thanks dimitri
I think it works now: