Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert statement bring back error. 2

Status
Not open for further replies.

elitecodex

Programmer
Dec 17, 2004
11
US
It shouldnt be... Here is my query:

Code:
INSERT INTO dbo.Notes ('CritPt_ID','Notes_Desc','Who_ID') VALUES (14,'test the testing testers',4)

The error is "Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Notes'."

I have tried Notes, dbo.Notes, dbo.[Notes] and they all return a similar error. Im at a loss... I know the table exists as I am looking right after and I have even looked at other SQL statements that actually work that reference the table. For instance...
Code:
SELECT     dbo.Notes.Notes_Desc, dbo.Notes.Date, dbo.[User].Username
FROM         dbo.[User] INNER JOIN
                      dbo.Notes ON dbo.[User].User_ID = dbo.Notes.Who_ID
WHERE     (dbo.Notes.CritPt_ID = 35)

Any help is greatly appreciated. Thanks.

 
This message occurs if you are looking in the wrong database. I agree with jhall, always use the database name in a qualified table name.
 
I checked the reserved word list and notes is not on there.

Next is to check to make sure the user has access to insert into that table
 
I checked the security permissions and I have full access to it (SELECT / UPDATE / INSERT / DELETE).

Im really confused... everything has gone well up til now.
 
How about removig these tiny quotes around column names?
 
It worked. I cant believe that SQL server is that picky. Im still in the learning curve coming from MySQL :)

Thanks alot for everyone's help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top