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 |
|
sherpa99
Starting Member
20 Posts |
Posted - 2006-02-20 : 11:22:12
|
I'm trying to select a random single field/record with a query and return it as an output parameter. my query won't validate -- what's wrong? Is there a better approach? thanks-----------------------------------CREATE PROCEDURE testCard_get( @ecomID int, @cardNumber varchar(50) OUTPUT)ASSELECT @cardNumber = Top 1 a.cardNumber FROM cards a INNER JOIN card_bndDetails b ON a.cardID = b.cardIDWHERE a.used = 0 AND b.ecomID = @ecomID AND a.shipEqualsBill IS NULLORDER BY NEWID()GO |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2006-02-20 : 11:31:21
|
just had the wrong order of keywordsSELECT top 1 @cardNumber = a.cardNumber ... Be One with the OptimizerTG |
 |
|
|
|
|
|