CodePudding user response:
DECLARE @ A VARCHAR (100)
The SET @ A='[123 * 456] B
SELECT SUBSTRING (@ A, CHARINDEX (' [' @ A) + 1, CHARINDEX ('] '@ A) - CHARINDEX ('/', @ A) - 1)
CodePudding user response:
If this is the [] up data, the direct drop directly replace [and] it is ok toDECLARE @ STR NVARCHAR (200)='[1.5 cm * 500 c]'
SELECT the REPLACE (REPLACE (@ STR, '[',' '), '] ', ')
If not you need to get the location of the [and], and then to intercept