Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
evanburen
Posting Yak Master
167 Posts |
Posted - 2011-10-13 : 08:40:47
|
Hi I want to pass a table name as a variable to this stored procedure but can't quite get it rightALTER PROCEDURE p_CashSample @RecordCount Int = NULL OUTPUT, DECLARE @TableName Table = 'PopulationBondsDeposits'AS SELECT @RecordCount = COUNT(*)FROM @TableName-- *** Level 1 ***SELECT TOP (CASE WHEN @RecordCount BETWEEN 2 AND 8 THEN 2 WHEN @RecordCount BETWEEN 9 AND 15 THEN 5 ELSE 10 END) *FROM @TableNameORDER BY NEWID() |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
evanburen
Posting Yak Master
167 Posts |
Posted - 2011-10-13 : 09:07:15
|
Dang. Thanks. |
 |
|
|
|
|