unable to select the column

  • when i am using bellow query i am getting problem.

    select * from table --> no issue table result is showing.

    where as when i use the column it was showing invalid column name.

    1. Column names are correct

    2. no deny

    select column from table is not working

  • Post table definition (the CREATE TABLE statement) and the query that you're using with the column name

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • llawws (1/11/2012)


    when i am using bellow query i am getting problem.

    select * from table --> no issue table result is showing.

    where as when i use the column it was showing invalid column name.

    1. Column names are correct

    2. no deny

    select column from table is not working

    Not a lot of detail to go on here. I think you are saying that when you select from the table with no where clause you get results but when you add your where clause you get no results? That means you don't have any data that meets the condition of the where clause.

    Can you post your actual query? That would provide a lot more information.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • May be an issue with the column name.

    Have you tried enclosing the name in square brackets?

    SELECT [Column Name]

    FROM SomeTable

    -- Gianluca Sartori

  • Maybe you need to do:

    SELECT * FROM schema.table

    If the table is not in your default schema, it won't just show up automatically.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks alot

    we have fix the issue.

    we have space with column name before and after.

    it was enclosing after including braces

  • llawws (1/11/2012)


    Thanks alot

    we have fix the issue.

    we have space with column name before and after.

    it was enclosing after including braces

    No, wait: you mean you have a column named " something "?

    Who in his right mind could ever name a column that way?

    -- Gianluca Sartori

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply