-1
Alter Procedure sp_Member(
@comcode int = 0,
@SubComCode int = 0
)
as
begin
set nocount on
If @comcode= 0
begin
select
(select sum(amount)
from tbcoudet
where memcode=tbm.memcode and expyear=(select max(expyear) from tbexpyear)
and exists(select itemcode
from tbitem
where [email protected] and
[email protected] and
itemcode=tbcoudet.itemcode
)
group by memcode,expyear
)'TurnOver'
, * into #subodh from tbmember tbm where can_flag='N'
end
If @SubComCode= 0
begin
Insert into #subodh
select
(select sum(amount)
from tbcoudet
where memcode=tbm.memcode and expyear=(select max(expyear) from tbexpyear)
and exists(select itemcode
from tbitem
where [email protected] and
itemcode=tbcoudet.itemcode
)
group by memcode,expyear
)'TurnOver'
, * from tbmember tbm where can_flag='N'
end
select top 10 * from #subodh where TurnOver is not null order by TurnOver desc
end
我的問題是,當我要去執行EXEC sp_Member @comcode='1',@subcomcode='1'
OR select top 10 * from #subodh where TurnOver is not null order by TurnOver
這些查詢的話,我歌廳錯誤「無效的對象名稱#subodh'。」請告訴我爲什麼我geting這個錯誤,我該如何解決它...請無效的對象名稱#subodh「