日期:2014-05-18 浏览次数:20612 次
create PROC aiml2that匹配流程
(
@thatpattern Varchar(5000),
@pattern text OUTPUT)
AS
BEGIN
SELECT @pattern=pattern FROM aiml2
WHERE thatpattern=@thatpattern
END
Declare @thatpattern Varchar(5000),@pattern Varchar(5000)
Set @thatpattern ='MY FAVORITE SUBJECT IS ARTIFICIAL INTELLIGENCE AND ROBOTS'
select @pattern=pattern from aiml2 WHERE thatpattern=@thatpattern order by pattern asc
select @pattern
create PROC aiml2that
@thatpattern Varchar(5000),
@pattern varchar(8000) OUTPUT
AS
BEGIN
SELECT @pattern=pattern
FROM aiml2
WHERE thatpattern = @thatpattern
select @pattern
END
--调用示例
DECLARE @thatpattern varchar(50)
DECLARE @pattern VARCHAR(50)
SET @thatpattern = 'a'
SET @pattern = 'b'
--这里返回的是一个数据结果集
exec dbo.aiml2that @thatpattern,@pattern OUTPUT
------解决方案--------------------
作为结果集返回去,在程序中用dataset存储返回前台就可以
create PROC aiml2that匹配流程
(
@thatpattern Varchar(5000)
)
AS
BEGIN
SELECT pattern FROM aiml2 WHERE thatpattern=@thatpattern
END
------解决方案--------------------
变量一次只能得到一个值了
返回多个值直接用查询
create PROC aiml2that匹配流程
(
@thatpattern Varchar(5000),
)
as
select pattern from aiml2 WHERE thatpattern=@thatpattern order by pattern asc