On 4 Nov 2003 21:04:27 -0800, arijitchatterjee123 (AT) yahoo (DOT) co.in (Arijit
Chatterjee) wrote:
Quote:
but instate of above block how can I dynamically generate this query?
---------------------------------------
declare mycur Cursor for exec (@query) |
--------------------------------------- |
The way I've done stuff like this in the past is to stuff the results
into a temp table and run a cursor off that.
Example:
declare @SQLstring varchar(100)
create table #foo (foovar int)
select @SQLString = 'select distinct foovar from footable'
insert into #foo exec(@SQLString)
declare foo_cursor for select distinct foovar from #foo
etc.
Obviously you really want to do this type of stuff when there is no
other way around it.
Quote:
Or tell me the way.
Regards
Arijit Chatterjee |