KBD

Keith Devens .com

Saturday, September 6, 2008 Flag waving
Mistakes are as serious as the results they cause. – House (The Mistake – ep 30)

Tag: SQL

Parents:

Daily link icon Thursday, July 24, 2008

  1. Download LINQPad (via).

       (0) Tags: [LINQ, Software, SQL]

Daily link icon Thursday, February 28, 2008

'Limit' clause in MSSQL

Solution 1: SQL Server Equivalent To MySQL And PostgreSQL Limit Clause - Joseph Scott’s Blog. Note: assumes unique keys.

SELECT TOP n *
FROM tablename
WHERE key NOT IN (
    SELECT TOP x key
    FROM tablename
    ORDER BY key
)

Solution 2: Finally a LIMIT clause for MS SQL. (Same solution recommended here, with a small explanation.)

select * from (
 select top 10 emp_id,lname,fname from (
    select top 30 emp_id,lname,fname
    from employee
    order by lname asc
 ) as newtbl order by lname desc
) as newtbl2 order by lname asc

Edit: The above is in SQL Server 2k... for 2005 there's a new row_number() function.

September 2008
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
282930 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 5 posts

Recent comments XML

new⇒I hate ASP.NET

CF, why pick that piece of trash?​Cold Confusion. Is it finally​really a OO...

ColdConfusion: Sep 5, 8:36pm

Maps of Iraq

This is for Linda, I will be​visiting that site some time in the​near futur...

Bob: Sep 5, 1:20pm

Girls, please don't get breast implants

Well alright I just read my above​comment and I wanted to add​this...I shou...

76.66.140.8: Sep 4, 7:31pm

Spider solitaire

I don't think the question was​necessarily if there are unbeatable​games.  ...

Jared: Sep 4, 12:44pm

Convert Pantone Colors to RGB and Hex - Color Conversion Chart

The colors on those website don't​seem to relate to the pantone data​we hav...

blah: Sep 3, 10:12am

Generated in about 0.287s.

(Used 10 db queries)

mobile phone