Michael,
That certainly worked. Thank you. What is interesting is that SQL cannot recognize its own parameters. I guess it's up to the guys who wrote the parser to figure out.
Aristotle
-------------------------------------------
>This won't work. When you use dynamic SQL, SQL Server considers it a seperate batch. It's not optimized when the compiler hits it and it has no access to variables outside of it
>
>If you want to make it work, you'll have to write the results to a temporary table and then read it from there.
>
>
>CREATE PROCEDURE GetRecordCount
> @Tablename varchar(30),
> @NumRecs integer OUTPUT
>AS
> CREATE TABLE #cnt (cnt integer)
> EXECUTE (INSERT INTO #cnt VALUES (SELECT COUNT(*) FROM '+@TableName+' WHERE include = ''Y'' ')
> SELECT @NumRecs = cnt FROM #cnt
> RETURN 0
>
>Or something like that <s>
>
>
>-Mike
Aristotle