0

I'm building a report using a stored procedure (Haven't done this before), this is the error i get when i run query from the report builder. But it works perfectly from sql server

"An error occurred while executing the query. There is already an object named 'TempResult' in the database.


ADDITIONAL INFORMATION:

There is already an object named 'TempResult' in the database. (Microsoft SQL Server, Error: 2714)"

  • 1
    Post your query . This error because you already have object with name `TempResult` in database. And may be in your query you are trying to create it again. – Mahesh Mar 13 '15 at 11:21
  • What is `TempResult`? – Fred Mar 13 '15 at 11:26
  • its a table i created "CREATE TABLE TempResult (CustomerID BIGINT,CUAccountID BIGINT,RepaymentDate DATE,ValueDate DATE,InterestRepayment Money,InterestAmtPaid Money,LoanRepayment money,LoanRepaymentPaid money,Score bit)" – SirGoddy Mar 13 '15 at 11:31
  • 1
    There is your problem. Once it has been created you cannot create it again. If you meant for it to be a temp table add # to the name `#TempResult ` then drop it after you are done with it. – Fred Mar 13 '15 at 11:36
  • If you need temporary table to store some data at the time of manipulating then you should use the [temporary tables](http://stackoverflow.com/questions/6991511/sql-server-temp-table-vs-table-variable). – Mahesh Mar 13 '15 at 11:36
  • That worked, thanks guys... However after running the query and getting the result, when i click "next" to continue my report design, I get another error "There was an error executing the query. Nullable object must have a value" – SirGoddy Mar 13 '15 at 12:17
  • If you run the SP in SSMS do you see any `NULL`'s (probably date fields, in my experience it is often date fields) – Fred Mar 13 '15 at 12:23
  • All date fields fields return values when run in ssms. I have **@Valuedate and @repaymentdate but these fields get values from the db based on the @CustomerID** – SirGoddy Mar 13 '15 at 13:49
  • **SET @Valuedate=(Select Cast(ValueDate as Date) as Valuedate from #TempCUTran where CUTransactionID=@CUTransactionID); Select @RepaymentDate=Cast(RepaymentDate as Date), @TotalRepayment=TotalRepayment, @InterestRepayment=InterestRepayment, @InterestAmtPaid=InterestAmtPaid, @LoanRepayment=LoanRepayment, @LoanRepaymentPaid=LoanRepaymentPaid From CULoanSchedule where ScheduleID=@ScheduleID If(@ValueDate<=@RepaymentDate) BEGIN SET @Score=1; SET @Amount=0.00;** – SirGoddy Mar 13 '15 at 13:51

0 Answers0