Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot pass the File Name
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00421483
Message ID:
00422192
Views:
10
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform