如何用sql server 2008选出 列值中间某两个字符间的字符存到另一列;例取出http:
\auto.163.com\new\10056.html中的auto.163.com\new存到另一列去...
\auto.163.com\new\10056.html中的auto.163.com\new存到另一列去
展开
2015-12-16
展开全部
create PROCEDURE UP_GETVALUE
AS
DECLARE @value VARCHAR(100), @tmp VARCHAR(100)
declare cursorA cursor for select KEYWORDS FROM
(SELECT '牛仔服' AS KEYWORDS UNION ALL SELECT '毛皮' UNION ALL SELECT '医药') AS aa
open cursorA
fetch next from cursorA into @tmp
SET @value = ''
while (@@fetch_status = 0)
BEGIN
SET @value = @value + @tmp + ' '
fetch next from cursorA into @tmp
END
SELECT rtrim(@value) AS keywords
close cursorA
deallocate cursorA
--测试
--EXEC up_getvalue
--结果
AS
DECLARE @value VARCHAR(100), @tmp VARCHAR(100)
declare cursorA cursor for select KEYWORDS FROM
(SELECT '牛仔服' AS KEYWORDS UNION ALL SELECT '毛皮' UNION ALL SELECT '医药') AS aa
open cursorA
fetch next from cursorA into @tmp
SET @value = ''
while (@@fetch_status = 0)
BEGIN
SET @value = @value + @tmp + ' '
fetch next from cursorA into @tmp
END
SELECT rtrim(@value) AS keywords
close cursorA
deallocate cursorA
--测试
--EXEC up_getvalue
--结果
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询