| Author |
Topic |
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-01-09 : 02:16:09
|
| hi all,is there any command to exclude columns when we select all..could be useful when the columns are too many, yet we need to select many2 column, but not all.. select * , deselect column21, column22, ... is this possible?to select ALL with some deselect columns...thanks in advance |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-01-09 : 02:21:44
|
there isn't a way. You have to specify the column name that you required. KH |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-01-09 : 02:56:03
|
| thanks btw khtan.i've follow the link, it suggest first N column, how about select x from column 1-100? |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-01-09 : 03:01:02
|
the script is there, you can modify it to your own requirements KH |
 |
|
|
maya_zakry
Constraint Violating Yak Guru
379 Posts |
Posted - 2007-01-09 : 03:12:40
|
| i always wonder, is SP = scripts? how do we write functions in sql server?pliz bear with me- :p~~~Focus on problem, not solution~~~ |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-01-09 : 03:50:24
|
Sorry i mean Stored Procedure KH |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-01-09 : 04:06:46
|
quote: Originally posted by maya_zakry thanks btw khtan.i've follow the link, it suggest first N column, how about select x from column 1-100?
Create 2 new parameter : @start int, @end intchanged the stored procedure to check for ORDINAL_POSITION between @start and @end. WHERE ORDINAL_POSITION BETWEEN @start AND @end KH |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-01-09 : 04:20:46
|
| "to select ALL with some deselect columns..."By the by, you should list the columns you want, and not use SELECT *, because it is more likely that your query plan will be cached, which helps performance.Also, someone may add extra columns to your table in the future, and if you do SELECT * you will be pulling that extra database back to your application - which wastes time and bandwidth - particularly if the newly added columns are datatype IMAGE containing massive images files!!!Kristen |
 |
|
|
|