我有一个存储过程,它会返回如下所示的行:
ALTER PROCEDURE GetReportBetweenTwoDates
@DateOne DateTime,
@DateTwo DateTime
AS
BEGIN
;
SELECT
VisitorID, VisitorName, VisitorAddress,
ContactNumber, Department, ToMeet, InTime,
Purpose, OutTime
FROM
tbl_visitor
WHERE
CONVERT(varchar(20), InTime, 110) BETWEEN CONVERT(varchar(20), @DateOne, 110) AND CONVERT(varchar(20), @DateTwo, 110)
END
我想要一个精选女巫归来这个结果:
code
-----
one
two
three
我该怎么做?
答案 0 :(得分:1)
你可以使用temptable并将过程的结果插入其中,然后在其上写下所需的查询:
create table #tbl (col varchar(50))
go
insert into #tbl
exec Your_stored_procedure
go
select col as code, col as title from #tbl
drop table #tbl