Results 1 to 4 of 4

Thread: CO is not a column?

  1. #1

    Thread Starter
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    CO is not a column?

    I have an assignment where I have to list out all the employees in europe. Now, I know how to do this but I've hit a roadblock. I need to figure out which country a location is in, which would be easy except I keep getting the same error.

    Here's a nice example:

    Code:
    SQL> select * from hr.countries;
    
    CO COUNTRY_NAME                              REGION_ID
    -- ---------------------------------------- ----------
    AR Argentina                                         2
    AU Australia                                         3
    BE Belgium                                           1
    BR Brazil                                            2
    CA Canada                                            2
    CH Switzerland                                       1
    CN China                                             3
    DE Germany                                           1
    DK Denmark                                           1
    EG Egypt                                             4
    FR France                                            1
    
    ... *snip*
    
    25 rows selected.
    
    SQL> select CO from hr.countries;
    select CO from hr.countries
           *
    ERROR at line 1:
    ORA-00904: invalid column name
    CO is clearly a column, yet it refuses to be used in a statement?? How can I select this column?
    Don't pay attention to this signature, it's contradictory.

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: CO is not a column?

    CO might be a reserved word...

    Try:

    select [CO] from hr.countries

    instead

    BTW - what database are you using?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    Re: CO is not a column?

    I think it's an oracle database (the error code is ORA).

    The square brackes give me a different error:

    Code:
    SQL> select [co] from hr.countries;
    select [co] from hr.countries
           *
    ERROR at line 1:
    ORA-00936: missing expression
    Don't pay attention to this signature, it's contradictory.

  4. #4
    Fanatic Member kaffenils's Avatar
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    946

    Re: CO is not a column?

    Try double quotes.

    Code:
    select "co" from hr.countries;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width