July 25, 2008 at 11:58 am
I have next procedure:
create table #desglose( Dia smalldatetime null, B_Salto smallint null )
declare @sql varchar(1024) set @sql = ''
select top 1 @K_Division = K_Division from #Divisiones order by K_Division
while @K_Division is not null begin
set @sql = 'alter table #desglose add [Div_' + cast(@K_Division as varchar) + '] float null '
exec (@sql)
delete from #Divisiones where K_Division = @K_Division
set @K_Division = null
select top 1 @K_Division = K_Division from #Divisiones order by K_Division
end -- while @F_Inicial <= @F_Final begin
alter table #desglose drop column b_salto
select * from #desglose
Server: Msg 207, Level 16, State 1, Procedure gp_proced, Line 72
Invalid column name 'b_salto'.
I need help by drop column. Thanks
July 25, 2008 at 12:46 pm
Are you running this on an isolated system, with you as the only user?
If not, because it's a global temp table, once it's created, multiple copies of the proc can access it. That means the first one will create it, modify it, then drop the column, but the second person accessing it, if they start while it still exists from the first person, might get that error.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 25, 2008 at 12:58 pm
Modify my proce,
But inside my process I believe the temporary board and I utilize this field B_Salto,
But in the end of the result I want to eliminate it of the temporary board because I do not want that show it in my consultation.
Thanks:w00t:
July 25, 2008 at 1:03 pm
Yes, I running this on an isolated system.
Thanks.:D
July 25, 2008 at 7:24 pm
But in the end of the result I want to eliminate it of the temporary board because I do not want that show it in my consultation.
Just exclude it from final SELECT statement.
_____________
Code for TallyGenerator
July 27, 2008 at 2:07 am
It will surely work, May be the problem is with the case sensitiveness of your server.. Alter the statement with same column name and try it out,
create table #a (id int,nam varchar(10))
insert into #a values(1,'aa')
insert into #a values(2,'ba')
insert into #a values(3,'ca')
select * from #a
alter table #a drop column id
select * from #a
Thanks and Regards,
Venkatesan Prabu, 😛
My Blog:
http://venkattechnicalblog.blogspot.com/
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply