Bence bu şablonu bir incele
SET @logdata = CONVERT(VARCHAR(MAX), SUBSTRING(@payload, 11, @length));
DECLARE @payload VARBINARY(MAX) = 0x234453006AD2C3005B71436C6173733A2061203A3A204173696D6F764661636164652E63616C6C28292072656672657368207B746F6B656E3D65303466663731622D336265342D343836632D623339622D3663633762396365646236397D10070D02040256;
DECLARE @header CHAR(3) ,
@id INT ,
@length SMALLINT ,
@logdebug CHAR(1) ,
@logdata VARCHAR(MAX) ,
@timestamp CHAR(6) ,
@cs CHAR(1);
SET @header = CONVERT(CHAR(3), SUBSTRING(@payload, 1, 3));
SET @id = CONVERT(INT, SUBSTRING(@payload, 4, 4));
SET @length = CONVERT(SMALLINT, SUBSTRING(@payload, 8, 2)) - 7;
SET @logdebug = CONVERT(CHAR(1), SUBSTRING(@payload, 10, 1));
SET @logdata = CONVERT(VARCHAR(MAX), SUBSTRING(@payload, 11, @length));
SET @timestamp = CONVERT(CHAR(6), SUBSTRING(@payload, @length + 11, 6));
SET @cs = CONVERT(CHAR(1), SUBSTRING(@payload, @length + 17, 1));
SELECT @header ,
@id ,
@length ,
@logdebug ,
@logdata ,
@timestamp ,
@cs;