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 offset 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=@UIDif 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 AdvancdMunna Kumar SinghBangaloreIndia"