November 17, 2005 at 9:24 am
Hi,
I have a stored procedure that,in part, looks like the following:
Select
@PB PB,
@Term Term,
@Dte Dte,
@CTerm CTerm,
{additional code.....that specifies where and temp table...}
End
The issue is that the stored proc returns an error "Column names in each table must be unique. Column name 'PB' in table '#TempTableName' is specified more than once."
If I change the name of PB to xPB, then I get the same error with the very next variable, etc, etc.
If anyone has any suggestions, I would be appreciate it.
Victor
November 17, 2005 at 9:48 am
November 17, 2005 at 1:51 pm
In stored Proc why you need to select temp. variable and then allias that.
Are this variable @PB, @Term .. input parameters to SP ?
If so then also it is hard to find any good reason for this select statement
Select @PB PB, @TERM Term...
Here I have place query for select from temp table with whatever tablename and where clause you provide.
In part-2 I have tried your way but that does not sound logical.
Create table #temp123
(pb int, term int,dte smalldatetime ,cterm int)
insert into #temp123 values (1,1,getdate(),1)
insert into #temp123 values (2,2,getdate(),2)
insert into #temp123 values (3,3,getdate(),3)
insert into #temp123 values (4,4,getdate(),4)
Select * from #temp123
Select PB, Term ,Dte,CTerm from #temp123
---Part 2
declare @PB int
declare @Term int
declare @Dte smalldatetime
declare @CTerm int
Select
@PB PB, @Term Term, @Dte Dte, @CTerm CTerm
from #temp123
select @PB, @term, @DTE, @cterm
----
Drop table #temp123
Kindest Regards,
Sameer Raval [Sql Server DBA]
Geico Insurance
RavalSameer@hotmail.com
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply