Hi!
There is an EXECUTE command on SQL Server you can use by the similar way in your Stored Procedures. For example:
EXECUTE ('SELECT * FROM '+@TableName+' A WHERE A.ID=' + convert(varchar(30),@ID))
Above query takes parameters of SP - @TableName and @ID value of yje ID field and returns a single record as a result.
>In analyzing a migration our VFP app to SQL Server, I'm trying to learn more about the capabilities of SQL Server 2000, especially in the area of stored procedures.
>
>Our existing VFP app runs some 'moderately' complex SQL queries, usually by building strings on the fly and then macro-expanding. So by the end, we're usually doing something like...
>
>SELECT &cSummaryLine ; (these would sum multiple fields)
> FROM &cFiles ; (could be as many as 5-6 tables)
> WHERE &cJoinConditions ; (often > 200 chars in length)
> GROUP BY &cGroupBy
>
>My question is whether anyone has gone through the effort of transitioning things like this to stored procedures in SQL Server, and any experiences they'd like to share.
>
>Also, is there a really good book (i.e. many examples) on stored procedures and programming in SQL Server?
>
>TIA,
>Kevin
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.