Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 select a column from result set

Author  Topic 

gsrinivas.
Yak Posting Veteran

56 Posts

Posted - 2009-06-13 : 10:30:06
dear sqlteam,
i would like to know the query "select a column from a result set ".
hear the result set is not a table or a view.

anybody please...


thanks
-srinivas

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-13 : 10:33:03
so where is the result set coming from ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-14 : 03:15:09
if its from a table valued function you can use

SELECT col FROM dbo.function(..)

if its from procedure use the second method on below link

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-06-26 : 02:26:35
This you need?

Select col1 from (
Select col1,col2,col3 from mytable) as tab where <condition>


Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-06-26 : 06:03:56
quote:
Originally posted by gsrinivas.

dear sqlteam,
i would like to know the query "select a column from a result set ".
hear the result set is not a table or a view.

anybody please...


thanks
-srinivas




You need to give more informations to avoid guesses

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

gsrinivas.
Yak Posting Veteran

56 Posts

Posted - 2009-07-04 : 03:52:21
yes senthil,
thats i want..

thanks
-srinivas
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-04 : 03:57:18
quote:
Originally posted by senthil_nagore

This you need?

Select col1 from (
Select col1,col2,col3 from mytable) as tab where <condition>
This is the same as

SELECT Col1 FROM MyTable WHERE <condition>



Microsoft SQL Server MVP

N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

gsrinivas.
Yak Posting Veteran

56 Posts

Posted - 2009-07-04 : 04:05:47
no peso,
this is not i want,

i want to select a virtual column from a result set
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-07-04 : 04:30:16
And what is a "virtual column" according to your definition?

For the link you posted, give the derived table a name like this.
Select  TheVirualColumnNameHere
from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
Integrated Security=SSPI','Execute yourdb..get_orders') AS v



Microsoft SQL Server MVP

N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

gsrinivas.
Yak Posting Veteran

56 Posts

Posted - 2009-07-06 : 03:31:57
dear peso,
i want to select annual salary from emp table.
for example the emp table contains following columns

empno,empname,monthly_salary.


now my quiry is to getting annual salary from emp table.

...............select monthly_salary*12[annula_salary] from emp

here, i say annual_salary is virtual column (that is derived column)
and the output (grid) is result set.

I WANT TO GET THE DERIVED COLUMN FROM RESULT SET .

(basically this requirement is need in t-sql block.
after executing some pocessing some result set occurs.
i want to select some derived columns from that resultset)

thanks
-gsrinivas





Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-06 : 03:36:01
[code]
select [annula_salary]
from
(
select monthly_salary*12[annula_salary] from emp
) a
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2009-07-19 : 20:39:49
quote:
Originally posted by gsrinivas.

(basically this requirement is need in t-sql block.
after executing some pocessing some result set occurs.
i want to select some derived columns from that resultset)



I'd really like to see your "T-SQL block" for this... it would help us figure out what you want.

--Jeff Moden
"Your lack of planning DOES constitute an emergency on my part... SO PLAN BETTER! "
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row"

Go to Top of Page
   

- Advertisement -