Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

unable to select the column Expand / Collapse
Author
Message
Posted Wednesday, January 11, 2012 7:30 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:45 AM
Points: 94, Visits: 319
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 #1233970
Posted Wednesday, January 11, 2012 7:55 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 4:16 AM
Points: 40,194, Visits: 36,599
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 2008, MVP
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

Post #1233997
Posted Wednesday, January 11, 2012 7:55 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 7:17 AM
Points: 13,085, Visits: 12,549
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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1233998
Posted Wednesday, January 11, 2012 7:56 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 6:47 AM
Points: 4,417, Visits: 10,717
May be an issue with the column name.
Have you tried enclosing the name in square brackets?

SELECT [Column Name] 
FROM SomeTable



--
Gianluca Sartori

How to post T-SQL questions
spaghettidba.com
@spaghettidba
Post #1233999
Posted Wednesday, January 11, 2012 8:17 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 13,890, Visits: 28,285
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
The Scary DBA
Author of: SQL Server Query Performance Tuning
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #1234016
Posted Wednesday, January 11, 2012 8:55 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, May 14, 2013 6:45 AM
Points: 94, Visits: 319
Thanks alot


we have fix the issue.

we have space with column name before and after.

it was enclosing after including braces
Post #1234064
Posted Wednesday, January 11, 2012 1:58 PM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 6:47 AM
Points: 4,417, Visits: 10,717
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

How to post T-SQL questions
spaghettidba.com
@spaghettidba
Post #1234357
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse