><<<snip>>>
>>>Try this
>>>
>>>SET @sqlcmd = 'SELECT
[@NumRecs
] = COUNT(email)
>>>FROM ' + @TableName
>>>WHERE Include = 'Y'
>>
>>That certainly works Sergey. However, the PRINT @MyNumber line does not print a value. That means that the value (@NumRecs) was not returned to the calling program properly.
>
>I just try it on my SQL Server and it works.
>What version of SQL Server are you using?
>My is 7.0
I am running 7.0 also. The sql sequence (running from within)Query Analyzer:
DECLARE @MyNumber int
EXEC GetRecordCount "NASA", @NumRecs = @MyNumber OUTPUT
PRINT '================'
PRINT @MyNumber
returns the following:
@NumRecs
-----------
105729
(1 row(s) affected)
=================
<<<<<---- 105729 should print here.
Notice that PRINT @MyNumber returns no value.
Thanks for your help.
Aristotle