Click here to Skip to main content
15,921,577 members
Home / Discussions / Database
   

Database

 
GeneralRe: Listing tables and views? Pin
-Dr_X-13-Feb-04 15:36
-Dr_X-13-Feb-04 15:36 
GeneralRe: Listing tables and views? Pin
Bill Dean13-Feb-04 15:43
Bill Dean13-Feb-04 15:43 
Generalcompare time part of datetime field Pin
asd175313-Feb-04 7:15
asd175313-Feb-04 7:15 
Generalprecentage of loading data in Dataset Pin
Saeed Tabrizi13-Feb-04 5:43
Saeed Tabrizi13-Feb-04 5:43 
General"Select top" command Pin
dlhson212-Feb-04 19:21
dlhson212-Feb-04 19:21 
GeneralRe: "Select top" command Pin
Motyka12-Feb-04 20:52
Motyka12-Feb-04 20:52 
GeneralRe: "Select top" command Pin
basementman13-Feb-04 5:58
basementman13-Feb-04 5:58 
GeneralRe: "Select top" command Pin
Bruce Duncan13-Feb-04 6:49
Bruce Duncan13-Feb-04 6:49 
As the other two replies mentioned, you can use the SET ROWCOUNT statement or construct and execute a sql statement dynamically.

But I read the other day the Yukon will allow expressions to be used as an argument to the TOP statement.

This is from http://msdn.microsoft.com/msdnmag/issues/04/02/TSQLinYukon/default.aspx[^]


"The T-SQL TOP option in Yukon has two significant enhancements. You can now specify as an argument to TOP an expression that can contain variables or even a self-contained query. You can also use the TOP option with modifying DML (INSERT, UPDATE, DELETE).

To specify an expression, you must enclose it in parentheses. The expression should be of the BIGINT datatype when not using the PERCENT option, and a float value in the range 0 through 100 when using the PERCENT option. The following code shows how to use an expression with a variable to return the requested number of earliest orders from the SalesOrderHeader in the AdventureWorks database:"


USE AdventureWorks

DECLARE @n AS BIGINT
SET @n = 5

SELECT TOP (@n) *
FROM SalesOrderHeader AS SOH
ORDER BY OrderDate, SalesOrderID




Searching the web without Google is like straining sewage with your teeth.
Userfriendly, 2003/06/07


GeneralRe: "Select top" command Pin
dlhson213-Feb-04 17:01
dlhson213-Feb-04 17:01 
GeneralRe: "Select top" command Pin
Hesham Amin13-Feb-04 23:03
Hesham Amin13-Feb-04 23:03 
QuestionCan I execute a DTS package from T-SQL? Pin
Thesisus12-Feb-04 5:24
Thesisus12-Feb-04 5:24 
AnswerRe: Can I execute a DTS package from T-SQL? Pin
Jeff Martin12-Feb-04 10:50
Jeff Martin12-Feb-04 10:50 
Generalgrant permission to access the Msysobjects Pin
Daminda12-Feb-04 2:53
Daminda12-Feb-04 2:53 
GeneralRe: grant permission to access the Msysobjects Pin
Mazdak12-Feb-04 3:30
Mazdak12-Feb-04 3:30 
GeneralData out of large File into MS Access DB Pin
93Current12-Feb-04 2:50
93Current12-Feb-04 2:50 
GeneralRe: Data out of large File into MS Access DB Pin
Bill Dean13-Feb-04 3:18
Bill Dean13-Feb-04 3:18 
GeneralRe: Data out of large File into MS Access DB Pin
93Current13-Feb-04 8:24
93Current13-Feb-04 8:24 
GeneralStoring RichText data in SQL Database Field Pin
bjulien11-Feb-04 15:54
bjulien11-Feb-04 15:54 
GeneralRe: Storing RichText data in SQL Database Field Pin
basementman13-Feb-04 6:01
basementman13-Feb-04 6:01 
GeneralTable Names Of a MS Access Database Pin
Daminda11-Feb-04 1:04
Daminda11-Feb-04 1:04 
GeneralRe: Table Names Of a MS Access Database Pin
Ian Darling11-Feb-04 2:18
Ian Darling11-Feb-04 2:18 
GeneralRe: Table Names Of a MS Access Database Pin
Thea Burger12-Feb-04 4:01
Thea Burger12-Feb-04 4:01 
GeneralRe: Table Names Of a MS Access Database Pin
FASTian17-Mar-04 20:11
FASTian17-Mar-04 20:11 
GeneralRe: Table Names Of a MS Access Database Pin
Thea Burger18-Mar-04 19:49
Thea Burger18-Mar-04 19:49 
GeneralStored procedure question Pin
LasVegasGuy10-Feb-04 8:20
LasVegasGuy10-Feb-04 8:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.