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
 General SQL Server Forums
 New to SQL Server Programming
 Adding Records

Author  Topic 

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2008-11-15 : 21:15:54
I am trying to add records to a table using the query below:

insert into dbo.Cash (Date, Acct_Type, Note, Member_Account_Number, GL_Account_Number, Amount)
values ('11/14/2008','Payment', 'Payment on account', 'C100405955', 'C00001200', -77)

I keep getting this error:

Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbo.Cash'.

What am I doing wrong?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-11-15 : 22:30:20
dbo.Cash does not exist in the database that you are executing the script. Either switch databases to where it exists via the drop down menu in SSMS/QA, via USE statement, or use the three-part naming convention for the object.

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

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-16 : 04:58:36
Also if table really exists, make sure its available in dbo schema and not in any other schema.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-16 : 12:00:55
quote:
Originally posted by visakh16

Also if table really exists, make sure its available in dbo schema and not in any other schema.



Thats what OP is doing.Please do as Tara said.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-16 : 12:07:47
quote:
Originally posted by sodeep

quote:
Originally posted by visakh16

Also if table really exists, make sure its available in dbo schema and not in any other schema.



Thats what OP is doing.Please do as Tara said.


sorry Sodeep. I didnt get you. I was suggesting OP to check if Cash table is existing under dbo schema or not.Didnt undersand what you mean by "Thats what OP is doing"
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-16 : 12:25:58
Visakh,

I was saying that you get that error when Executed under different database or schema for table is wrong.Sorry you are correct too.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-16 : 12:31:47
quote:
Originally posted by sodeep

Visakh,

I was saying that you get that error when Executed under different database or schema for table is wrong.Sorry you are correct too.



No problem
sorry i couldnt understand your reply
Go to Top of Page
   

- Advertisement -