当前位置: 代码迷 >> Sql Server >> 请帮小弟我看一下!多谢
  详细解决方案

请帮小弟我看一下!多谢

热度:35   发布时间:2016-04-27 19:06:18.0
请帮我看一下!谢谢
请帮我看一下,谢谢。我想明白下面是什么意思及详细的变量取数原理


SELECT   @startPosition   =   CHARINDEX(@str,@chrWhere,0)
IF   @startPosition   =   0
    RETURN
SELECT   @endPosition   =   CHARINDEX(@str,@chrWhere,@startPosition+1)
IF   @endPosition   =   0
    RETURN
SELECT   @attribute   =   SUBSTRING(@chrWhere,@startPosition+1,@[email protected])


SELECT   @startPosition   =   CHARINDEX(@str,@chrWhere,@endPosition+1)
IF   @startPosition   =   0
    RETURN
SELECT   @endPosition   =   CHARINDEX(@str,@chrWhere,@startPosition+1)
IF   @endPosition   =   0
    RETURN
SELECT   @start   =   SUBSTRING(@chrWhere,@startPosition+1,@[email protected])


SELECT   @startPosition   =   CHARINDEX(@str,@chrWhere,@endPosition+1)
IF   @startPosition   =   0
    RETURN
SELECT   @endPosition   =   CHARINDEX(@str,@chrWhere,@startPosition+1)
IF   @endPosition   =   0
    RETURN
SELECT   @end   =   SUBSTRING(@chrWhere,@startPosition+1,@[email protected])



------解决方案--------------------
[email protected]@[email protected]
SELECT @startPosition = CHARINDEX(@str,@chrWhere,0)
IF @startPosition = 0
RETURN
[email protected]
SELECT @endPosition = CHARINDEX(@str,@chrWhere,@startPosition+1)
IF @endPosition = 0
RETURN
[email protected]@[email protected]
SELECT @attribute = SUBSTRING(@chrWhere,@startPosition+1,@[email protected])

--下面意思差不多
  相关解决方案