Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Reporting Services

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-01-09 : 08:25:42
Munna Kumar Singh writes "


Hi,
I am new for the Reporting Services. I need to generate a reports based on a stored procedure. When we call the stored procedure it says Invalid object name '#LType'. (Microsoft SQL SERVER, Error:208) .



If we see the stored procedure, we find that there is a temporary table '#LType' where we are storing the data and applying some condition for fatching the records from the table. At the bottom of the stored procedure we are also dropping the temporary table.The stored procedure looks like:




alter procedure Test4 .
@UID int,@varSourceType varchar(10)=null
........
........
as
set quoted_identifier off
set nocount on
declare @BranchIDsql varchar(1000),@varleveltype varchar
......
.....
Begin

create table #LType (LevelType varchar(4))
insert into #LType select ltrim(rtrim(UL.varleveltype)) from tbluserlevel UL inner join tblUserProfile UP on UL.intUserProfileID=UP.intUserProfileID where UP.intUserLoginID=@UID
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[BID]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[BID]
create table BID (intUlBranchID int)

if ((select count(Leveltype) from #LType where LevelType='CORP')>0) Begin
set @BranchIDsql="insert into BID select tblULBranch.intUlBranchID from tblULBranch where intULBranchGroupID in
(select intULBranchGroupID from tblULBranchGroup where intULCountyID in
(select intULCountyID from tblULCounty where intULRegionID in
(select intULRegionID from tblULRegion where intULCompanyID in
(select intULCompanyID from tblULCompany where intULCompanyGroupID in
(select intULCompanyGroupID from tblULCompanyGroup where intULCorporateID in
(select intlevelvalue from tblUserLevel where intUserProfileID in
(select intUserProfileID from tblUserProfile where intUserLoginID in ("+convert(varchar,@UID)+"))))))))"
exec(@BranchIDsql)
End
...............
...............
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[#LType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[#LType]



Thanks in Advancd

Munna Kumar Singh
Bangalore
India
"

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-01-09 : 12:49:25
Have the following

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[#LType]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[#LType]

just before create statement and c.
Go to Top of Page
   

- Advertisement -