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 |
blackX
Posting Yak Master
102 Posts |
Posted - 2008-07-14 : 13:42:55
|
I need a procedure that will accomplish the followingupdate member set primarymarketgroup=@newmarket where member_id in(select top @number from member where primarymarketgroup=@oldmarket)The problem is I cannot pass a value to the top clause, is this possible? Thanks in advance |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-07-14 : 14:13:18
|
http://www.sqlteam.com/article/dynamic-sql-or-how-do-i-select-top-var-recordsGreetings WebfredThere are 10 types of people in the world: Those who understand binary, and those who don't... |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-14 : 14:27:19
|
quote: Originally posted by blackX I need a procedure that will accomplish the followingupdate member set primarymarketgroup=@newmarket where member_id in(select top @number from member where primarymarketgroup=@oldmarket)The problem is I cannot pass a value to the top clause, is this possible? Thanks in advance
you can if you use sql 2005 or more. if its 2000, you've to go for dynamic sql or use set rowcount |
 |
|
blackX
Posting Yak Master
102 Posts |
Posted - 2008-07-14 : 16:04:00
|
Thanks for the link, i got it |
 |
|
|
|
|