Home > database >  In db2 database, how to use SQL to intercept []
In db2 database, how to use SQL to intercept []

Time:09-22

Assuming fields has been stored in the database in the column, the column name for A

CodePudding user response:

 
- don't abandon trouble with this try
DECLARE @ STR varchar (2000)
Set @ STR='10 the FSF sf, [fdfd5661] fsd12'
Select
REPLACE (REPLACE (SubString (@ STR, CHARINDEX (' [' @ STR), CHARINDEX ('] ', the SubString (@ STR, CHARINDEX ('/', @ STR), CHARINDEX ('] '@ STR)))),' [', ' '), '] ', ' ')

CodePudding user response:

DECLARE @ STR varchar (2000)
Set @ STR='10 the FSF sf + [fdfd5661] (fsd12)'

SELECT SUBSTRING (@ STR
, CHARINDEX (' [' @ STR) + 1
, CHARINDEX ('] '@ STR) - CHARINDEX (' [' @ STR) - 1
)

CodePudding user response:

  • Related