Snippets of the day – Thursday, January 30, 2014

Posted on Posted in Snippets


Here are some of the most recently published snippets!

linux bash while statement script

This is a very simple example of while statement in linux bin bash console.
The while condition terminates after N iterations, printing a counter for each loop.

Open the snippet

Author:    lbottaro

Transpose Query Output in SQL Server

This script will return result of the query passed as parameter in transposed form. It works on all version of Sqlserver starting with 2k.
Along with query definition you can limit number of rows specifying @Top parameter with max value of 1000. If you want original query result, you can pass value 1 to @Original parameter.
By Florian Cechi,

EXEC [dbo].[transpose_query_output]
@Query =

select 1 id
, ”red” Colour
, ”Primary” type
select 2
, ”yellow”
, ”Primary”
select 3
, ”orange”
, ”Secondary”

,@Orignal = 1

Open the snippet

Author:    cghersi

Leave a Reply

Your email address will not be published. Required fields are marked *