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 […]


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 […]


240 reads


Daily Coping 24 Sept 2021


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

Using environment variable files for SQL Server in containers


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

How to Design Backups in SQL Server?


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

Read the latest Blogs


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...


By LD3060

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

Visit the forum


SQL Server Q&A from the SQLServerCentral community

Get answers