Hi,
I'd like to output the result from a query in a stored procedure.
The challenge is that the result from the query is unknown, so i'd like to iterate through the returned rows and output each field dynamically.
example:
if object_id('dbo.create_insert') is not null
drop procedure dbo.create_insert
go
create procedure dbo.create_insert(
@birthdate int
, @personnr int
, @tablename varchar(8)
)
as
declare cur_create_insert cursor for
select *
from @tablename
where birthdate = @birthdate
and personnr = @personnr
And now!
open cursor cur_create_insert
while (result has more rows)
while (there are more columns)
print column
Is this possible?
-Thomas