Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Problem using temporary table in Sql server 2005

$
0
0

I have this stock procedure 

alter procedure Eqp_Traitement as begin SET nocount on; declare @num_row as int declare @sqlstmt as varchar(max) declare @listetable as varchar(max) declare @eqp as int declare @site_id as int create table #t_eqp(Equipement varchar(max)) set @sqlstmt ='select Equipement into #t_eqp from nss_dico..vassocier' exec(@sqlstmt) set @sqlstmt='select Equipement from #t_eqp' exec(@sqlstmt)

end

I don't have any result when I execute them

And when I execute the same procedure without temporary table he returns the correct result 

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

alter PROCEDURE Eqp_Traitement

AS
BEGIN
	SET NOCOUNT ON;
	declare @num_row as int
	declare @sqlstmt as varchar(max)
	declare @listetable as varchar(max)
	declare @eqp as int
	--declare @site_id as int
	create table #t_listeqp (Equipement varchar(300))
   	set @sqlstmt =('select Equipement from nss_dico..vassocier')
	exec(@sqlstmt)
end



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>