May 29, 2008 at 12:26 am
Is it possible?
I have one table with 35 columns. I want to write a select statement which should display data of all columns expect some columns (e.g. column 2,4 and 10).
May 29, 2008 at 1:11 am
Sure... what's the problem? Only those columns that you name in the SELECT will be returned.
If you are asking whether you can write SELECT * FROM .... and exclude some columns, you can't - and it is a bad idea anyway. You should not use SELECT * at all - well, with a few exceptions, one of them being WHERE EXISTS (SELECT * ...); I also sometimes use SELECT * FROM view, because the view already contains only those columns that need to be returned. Otherwise, the * is not best practice.
May 29, 2008 at 3:03 am
It's not possible. You should explicitly mention the column names you want:
Select column 1, column2, column 5, column 7
From...
That's also a best practice.
Warm Regards,
Neel aka Vijay.
May 29, 2008 at 3:20 am
My query is for example if you have a table with column named from a to z. I want to display all columns expect b,e,f.
Instead to writing all columns like
Select a,c,d,g,h,....z from
Is it possible to write any query or Stored Procedure or UDF like below. (-) is just a sample.
Select b(-),e(-),f(-) from
So it should display all columns expect b,e and f.
May 29, 2008 at 3:44 am
Not to my knowledge.
Warm Regards,
Neel aka Vijay.
May 29, 2008 at 4:02 am
You can with dynamic SQL. but the real question is WHY?
N 56°04'39.16"
E 12°55'05.25"
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy