Home Forums SQL Server 7,2000 T-SQL T-SQL Equivalent to MS Access'' "First" function RE: T-SQL Equivalent to MS Access'''' "First" function

  • the equivilent of the First() function is SELECT TOP 1 COLUMNNAME from sometable order by COLUMNNAME ;

    the TOP function can give you the top 10 like david letterman, or return a percent of the values:

    SELECT TOP 15 PERCENT * FROM SOMETABLE

     

    without an explicit order by in your statement, it would be the first # of records, so make sure you always use an ORDER BY statement to get the results you want.

     

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!