網上的問題:html
參考這篇《函數PARSENAME使用和截取字符串》http://www.javashuo.com/article/p-qynadabw-ev.html 的方法:ide
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