Hi
)
What I'm trying to do is turn a recordset into one column of data with mutliple rows ie:
SourceData =
ID Firstname Lastname Country
1 Martin Anders England
and I need
Col1
Martin
Anders
England
I've tried to write it as a cursor but my experience of cursors is very limited and It won't even parse!
Can anyone help me please!!
My cursor is below.
declare @var1 varchar(50),declare @var2 varchar(50),declare @var3 varchar(50)
declare cursor cu for
select Firstname, Lastname, Country from tableb
open cu
fetch next into @var1, @var2, @var3
while @@fetch_status = 0
begin
fetch next into @var1, @var2, @var3
end
close cu
deallocate
I Hopesomeone can help me.
Many Thanks
What I'm trying to do is turn a recordset into one column of data with mutliple rows ie:
SourceData =
ID Firstname Lastname Country
1 Martin Anders England
and I need
Col1
Martin
Anders
England
I've tried to write it as a cursor but my experience of cursors is very limited and It won't even parse!
Can anyone help me please!!
My cursor is below.
declare @var1 varchar(50),declare @var2 varchar(50),declare @var3 varchar(50)
declare cursor cu for
select Firstname, Lastname, Country from tableb
open cu
fetch next into @var1, @var2, @var3
while @@fetch_status = 0
begin
fetch next into @var1, @var2, @var3
end
close cu
deallocate
I Hopesomeone can help me.
Many Thanks