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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Invalid object dbo.TableName

Author  Topic 

dd121
Starting Member

11 Posts

Posted - 2010-11-12 : 18:33:45
I dont know. everything seems to be resolved, i have a stored procedure:



ALTER PROCEDURE dbo.InsertGenLedgerData


(
@Date date,
@Description nvarchar(50),
@Debit float,
@Credit float,
@CategoryID int
)

AS

BEGIN

INSERT INTO dbo.GeneralLedger (TransDate,TransDescription,CategoryID,Debit,Credit)
VALUES (@Date,@Description, @CategoryID,@Debit,@Credit);

COMMIT TRANSACTION;
END



i add data in the windows form, and then it executes the stored procedure and gives the invalid object dbo.GeneralLedger exception :S

i have no idea about it

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-11-12 : 18:47:27
You have a COMMIT without a BEGIN TRAN. And you don't even need a transaction here as there is only one DML query and nothing else.

I am surprised you aren't getting errors regarding the badly formed transaction.

Are you sure dbo owns the table?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

dd121
Starting Member

11 Posts

Posted - 2010-11-13 : 07:38:52
i have commented out COMMIT TRANSACTION. but i still get the same error. Invalid object name dbo.General Ledger. Here are the properties of the General Ledger Table:



Name: [General Ledger]
Database Name: finaldb
Description:
Schema: dbo
Server Name: pc\sqlexpress



i dont understand what u mean "dbo owns the table" ? U mean the schema?
Go to Top of Page

dd121
Starting Member

11 Posts

Posted - 2010-11-13 : 07:54:57
the prb is resolved. i used the Query Builder to insert the values:



INSERT INTO [General Ledger]
(TransDate, TransDescription, CategoryID, Debit, Credit)
VALUES (@Date,@Description,@CategoryID,@Debit,@Credit)
Go to Top of Page
   

- Advertisement -