Hello all, how can I select one or more columns from a table by column-index and NOT by columnname? e.g.: SELECT tbl1.[1], tbl1.[2], tbl1.[3] FROM Orders AS tbl1 and NOT like this: SELECT tbl1.OrderNo, tbl1.ProductNo, tbl1.Price FROM Orders AS tbl1 Is that possible in MS-SQL 2000? Thanks a lot in advance kind regards Otto
As far I know, no. Luis Martin Moderator SQL-Server-Performance.com One of the symptoms of an approaching nervous breakdown is the belief that one's work is terribly important Bertrand Russell All postings are provided “AS IS†with no warranties for accuracy.
It's not really "a pity". It really isn't. It's more a matter of perspective. Are you by any chance a programmer new to SQL Server? You will find that with databases, (1) it is a good thing to just know the data structure before working on any procedure or query, and (2) it is good to know about set-based operations - newby T-SQL developers often have to unlearn the loop-through-recordset approach they're familiar with, and start thinking in terms of T-SQL batch operations. Also, if you're just coming into the realm of bearing responsibility for actual data, not just the interface, you will find that you probably have taken data integrity for granted, and you will start to appreciate that the easy way out is usually not the proper solution. Have fun!
Select query with column index is not possible. But in select query order by with selected column index is possible. Like Select col1,col2 from urtable order by 1 so here 1 is col1.
Why do you want to do this? Do you need something like this? http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=9668 Madhivanan Failing to plan is Planning to fail