sameer2010
asked on
Name the intermediate resultset
Hi,
Below is a simple query that I am using. I wanted to know -
1. Is it possible to do the same without declaring a variable @a. e.g. some pre-defined dummy system variable.
2. Can the output of this query be captured as a table and used for further processing. PS: I do not want to define temp table.
Thanks,
Sam
Below is a simple query that I am using. I wanted to know -
1. Is it possible to do the same without declaring a variable @a. e.g. some pre-defined dummy system variable.
2. Can the output of this query be captured as a table and used for further processing. PS: I do not want to define temp table.
Thanks,
Sam
declare @a int;
set @a = 0;
while @a < 5
begin
select @a
set @a = @a + 1
end;
this is not a query
it is a procedure
a procedure is not the same as a query
a procedure can produce output and so can a query
but they are not the same
it is a procedure
a procedure is not the same as a query
a procedure can produce output and so can a query
but they are not the same
ASKER
I agree. Please read the same as "procedure" instead of "query".
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Okay. I thought the second one should be possible. Because dbms would be storing the data to some storage and it should be possible to aggregate the results from the temp storage (not created by us explicitly though)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot...spt_values was a learning for me. :-)
What is the reason for B rating?
ASKER
I had two related questions.
1. Do we have some pre-defined variable which can be used? The answer is No
2. Is it possible to store the resultset in some table without declaration and insert? The anwer is No.
While spt_values was a learning, and an interesting way to generate the series, my original question was different.
1. Do we have some pre-defined variable which can be used? The answer is No
2. Is it possible to store the resultset in some table without declaration and insert? The anwer is No.
While spt_values was a learning, and an interesting way to generate the series, my original question was different.
ASKER
Open in new window