[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

Invalid Column Name

If anyone have an idea...

When I try to  UPDATE  the column TipoAyuda of the table AyudaEcon I receive the message 'Invalid Column Name CodAyudaEcon' wich is the primary key.  I can't INSERT rows neither.
However, if I do the following:

SELECT CodAyudaEcon
   FROM AyudaEcon
WHERE CodAyudaEcon = '0001'

I receive the expected results.

I  can also select the column name from the Sysobjects table of the database.


What can be happening on this table?

0
gpolanco
Asked:
gpolanco
1 Solution
 
cardsCommented:
Tables default the owners as SA unless someone else creates the table.  If the table belong to a different owner then, while running a query you have to include the owners name in the query. Only time you do not is when the owner is SA. Look at the table and see who owns the table. It will be in parentheses by the table name. Books online show the correct syntax for this query. (dbo) is the SA tables.
0
 
gpolancoAuthor Commented:
Hi Cards, I'm sorry to say that  what you adviced to do was the first thing I did.

For future advices to this strange error, would help to know that I'm not a beginner using SQL-SERVER.  I decided to post this questions because what is happening is very strange and I can't think what held is happening.

0
 
StefaanCommented:
Hi gpolanco,

I just wanted to make sure.  Do you have the necessary permissions on the Table, or even on that specific field ?

0
 
rayasamCommented:
There might be corruption with some tables in the database. Please do a DBCC CHECKDB followed by a DBCC NEWALLOC on the database which contains these tables. Look for any errors in the results. If you have a large database the DBCC CHECKDB might take quite sometime,in which case I would suggest using the DBCC CHECKTABLE(AyudaEcon) first. If you don't find any errors then go ahead with dbcc checkdb and dbcc newalloc as mentioned earlier.

(PS: I'm assuming that you have all required permissions on the target table and columns. )
0
 
gpolancoAuthor Commented:
Hi rayasam, thanks for your proposed answer.  I had urgency about solving the porblem in that table and I decided to drop and to recreate it before I received your proprosed answer. It obviously solve the problem.  

Before drop it, I did a DBCC CHECKDB and it didn't report any errors. I didn't do any DBCC NEWALLOC, thus I don't know if it would solve it.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now