How to get random rows from SQL Server Table - TSQL Tutorial Part 117

Publicado em: 16 Setembro 2016
no canal de: TechBrothersIT
14,305
114

SQL Server / T-SQL Tutorial Scenario:
How to get random rows from SQL Server Table

Scenario:
You are working as SQL Server developer. You are asked to provide sample random data from dbo.Customer table. You might asked to provide random 100 rows or some percent of total data from table. What query you will use to provide required output?

Solution:
In previous post, we learnt how to get top n rows from table. We can either provide row count or percent of records we want to get from a table by using TOP in our select query.

We can use the same Top clause but as we are asked to provide the random records, we need to sort them randomly first. We can use newid() function in order by clause to sort them randomly.

Link to scripts used in SQL Server / TSQL Tutorial Video
http://www.techbrothersit.com/2016/06...

Check out our website for Different SQL Server, MSBI tutorials and interview questions
such as SQL Server Reporting Services(SSRS) Tutorial
SQL Server Integration Services(SSIS) Tutorial
SQL Server DBA Tutorial
SQL Server / TSQL Tutorial ( Beginner to Advance)
http://www.techbrothersit.com/


Nesta página do site você pode assistir ao vídeo on-line How to get random rows from SQL Server Table - TSQL Tutorial Part 117 duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário TechBrothersIT 16 Setembro 2016, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 14,305 vezes e gostou 114 espectadores. Boa visualização!