- DECLARE @str VARCHAR(1000)='||MO21|TMT-0080|1|10'
-
- SET @str = REPLACE(STUFF(@str,1,2,''),'|','.')
- SELECT PARSENAME(@str,3)
- --PARSENAME(@str,4) AS [TABLE_CATALOG],
- --PARSENAME(@str,3) AS [TABLE_SCHEMA],
- --PARSENAME(@str,2) AS [TABLE_NAME],
- --PARSENAME(@str,1) AS [COLUMN_NAME]
- GO