Adding Sorts to SQL Server Views

Microsoft says that you cannot add an ORDER BY to a view unless it comes with a TOP clause at the beginning of the query. Many people think that if that's true then you cannot "Order" the whole query but only the top few. However, this is not true because when you use TOP 100 […]

2002-07-11

235 reads

Finding the Nth Maximal Value

This procedure gets a tablename, column and an integer number N as parameters and finds the Nth maximum value of the column's value in a table for example :  running it with 'products', 'UnitPrice' , 13 ,  @reswill get the 13TH largest value of unitprice from products is no such N exist an error message […]

2002-07-10

240 reads

Blogs

Daily Coping 24 Sept 2021

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Using environment variable files for SQL Server in containers

By

There are a whole bunch of environment variables that can be used to configure...

How to Design Backups in SQL Server?

By

The Recovery Point Objective (RPO) and Recovery Time Objective (RTO) are basic concepts related...

Read the latest Blogs

Forums

SELECT CONTAINS is limited to 4000 characters

By zequion

In c# I use a function that generates Sql code that is executed through...

help with script to calculate gaps and overlaps from list of times

By chenks

hi got a question here that i hope someone can help with. i have...

Automatic INSERT-INTO

By LD3060

I have a view in my database where data is stored, it has 2...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers