Platform: MS SQL 7.00 - 7.00.1063 Standard Edition / Win2000
I wish to store the numeric result of a query into a variable, as
described below. This does not work, it fails on the last line with
syntax error. Is there a way to do it?
(The reason I want to do this is to store the count into a table,
therefore eventually do an update table with the variable.)
declare @tmp_select char(500)
declare @mycount int
set @tmp_select = 'select count(*) from dptest'
exec(@tmp_select)
set @mycount=exec(@tmp_select)