一.使用临时表方式处理
EXEC [dbo].[ProcTotalScoreCountStatistics] '报告质量','2021-08-08 10:32:00','2024-12-30 10:32:00','999002002' ------------------------------查询存储过程数据步骤------------------------------ --1.创建临时表 create table #temp ( type nvarchar(50), five nvarchar(50), four nvarchar(50), three nvarchar(50), two nvarchar(50), one nvarchar(50), totalcount nvarchar(50), qualitybatch nvarchar(50) ) --2.将存储结果存入临时表 insert into #temp EXEC [dbo].[ProcTotalScoreCountStatistics] '报告质量','2021-08-08 10:32:00','2024-12-30 10:32:00','999002002' --3.查询临时表数据,即存储结果数据 select * from #temp where qualitybatch =1 --4.清除临时表 drop table #temp

二.使用表变量处理方式(执行结果如上图所示)
EXEC [dbo].[ProcTotalScoreCountStatistics] '报告质量','2021-08-08 10:32:00','2024-12-30 10:32:00','999002002' --1. 申明表变量 declare @tempTable Table ( type nvarchar(50), five nvarchar(50), four nvarchar(50), three nvarchar(50), two nvarchar(50), one nvarchar(50), totalcount nvarchar(50), qualitybatch nvarchar(50) ) --2. 执行存储过程并将存储过程的返回结果集插入表中 insert into @tempTable EXEC [dbo].[ProcTotalScoreCountStatistics] '报告质量','2021-08-08 10:32:00','2024-12-30 10:32:00','999002002' --3. 检索、查询 select * from @tempTable where qualitybatch =1
博客内容主要用于日常学习记录,内容比较随意,如有问题,还需谅解!!!

浙公网安备 33010602011771号