sql中创建临时表的存储过程

USE RXin
GO

/****** Object:  StoredProcedure [dbo].[Rx_blbgao]    Script Date: 06/18/2019 11:16:58 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO



CREATE PROCEDURE [dbo].[Rx_blbgao] 
	@date1 varchar(50)='',
	@date2 varchar(50)=''
		
AS

if object_id('tempdb..#tempTable0531') is not null
 Begin
    drop table #tempTable0531
 End
 
 select * into #tempTable0531 from xx

BEGIN

		select ddhao,chejian,gongxu,jieshou,wcsliang,absliang, fgsliang,cishu, blsliang,wcsjian,czyuan,blyying,lryuan,lrrqi from #tempTable0531 order by wcsjian desc
	
END



GO


 

你可能感兴趣的:(sql中创建临时表的存储过程)