DECLARE @sonumber BIGINTSELECT @sonumber=CONVERT(BIGINT, @serverId + Substring(CONVERT(VARCHAR(4), Datepart(yy, Getdate())), 4, 1) + Substring(CONVERT(VARCHAR(10), Getdate(),12),3,6) + CONVERT(VARCHAR(100), CAST( Rand()*(999999 -100000)+100000 AS DEC…