Presents your SQL SERVER E-NEWSLETTER for March 2, 2004 <-------------------------------------------> HOW YUKON T-SQL ENHANCEMENTS BOOST PRODUCTIVITY Yukon offers a number of feature enhancements to T-SQL, including two extensions to the TOP keyword. Here's how this keyword works in SQL Server 2000: SELECT TOP 10 [PERCENT] * FROM Table1, Table2, Table3 WHERE SomeCondition ORDER BY SomeColumn The PERCENT keyword requires a value from 1 to 100; without the value, an integer is required. In both cases, it isn't possible to pass a variable to be plugged into this value. In Yukon, both versions of TOP accept variables in the following form: DECLARE @MyValue AS BIGINT SET @MyValue = 10 SELECT TOP (@MyValue) [PERCENT] * FROM Table1, Table2, Table3 WHERE SomeCondition ORDER BY SomeColumn This code declares the value @MyValue; it doesn't accomplish anything new in this context, but the value could be passed into a stored procedure or table function, enabling you to create a variety of result sets from a single source. In the past, I would duplicate this functionality with the copy-and-paste technique. This new functionality will enable me to delete loads of almost identical procedures and replace them with a single parameterized procedure. And, instead of canning a few variants (sales10, sales20, etc.), I'll be able to let the user decide how many results to include in her request--without changing a line of code. Now that's productivity! NOTE: This information is subject to change by the release date of Yukon. Arthur Fuller has been developing database applications for 20 years. His experience includes Access ADPs, Microsoft SQL 2000, MySQL, and .NET. ----------------------------------------