Quantcast
Channel: Tallan's Technology Blog » gwilliams
Viewing all articles
Browse latest Browse all 5

Two more tools for your bag of T-SQL tricks

$
0
0

Have you ever been writing a new view and had the need to use an ORDER BY only to be greeted by an error message when you go to create the view. Never fear, there is a solution. ORDER BY can only be used in views, inline functions, derived tables, sub-queries, and common table expressions if the keywords TOP or FOR XML are used. Thus we can either use TOP or FOR XML to get our solution. We will on talk about the TOP Keyword today and save FOR XML for another time.

TOP allows you to select the first ‘n’ records returned from a select. Consider the following table of s


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images