> You could use a temporary table?
>
> (Quotes corrected)
> select @sql='select au_lname into #temp from authors where
> au_id=''172-32-1176'''
> exec (@sql)
> select @result=au_lName from #temp
I'm not sure this will work because the scope for #temp will probably only
be the exec call and it will be freed immediately after the exec finishes.
I would suggest something like Neven's suggestion or perhaps:
declare @result varchar(255)
declare @sql varchar(255)
select @sql='select au_lname from authors where au_id="172-32-1176"'
create table #result
(
the_result varchar(255)
)
insert into #result
exec(@sql)
select @result = the_result
from #result
drop table #result -- Will happen automatically if this is in a stored proc.
Regards,
David Brennan.
DB Solutions Ltd.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"