Hey Makr,

here you go.

DECLARE @myCount INT
SET @myCount = 3

SET ROWCOUNT @myCount

SELECT * FROM tbl

-----Original Message-----
From: Mark M [mailto:[EMAIL PROTECTED]
Sent: Friday, 4 June 2004 4:20 PM
To: CFAussie Mailing List
Subject: [cfaussie] [OT] MS SQL Stored Proc Question


Hey guys -

I want to have a stored proc that returns back the top 'n' number of items that I ask 
for (rather than
hardcoding the value).

i.e.
--
create procedure topResults
   @total numeric

select top @total
  *
from
  myTable

RETURN
--

However, it really doesn't like the 'top @total' 'incorrect syntax' is all I get.

Any way I can do this without resorting to dynamic SQL (either stored proc, or CF side)

Cheers,

Mark

------------------------------------------------------------------
[EMAIL PROTECTED]
ICQ: 3094740




---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Register now for the 3rd National Conference on Tourism Futures, being held in 
Townsville, North Queensland 4-7 August - www.tq.com.au/tfconf

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to