STAND FOR TREES – SAVE THE ENVIRONMENT

Trees are like gifts on the earth, combat global warming by absorbing carbon dioxide and producing oxygen, contribute to soil health, retain water etc etc. The earth needs more! they deserve more credit for all the amazing things they do for us.

I Stand For Trees. I support this campaign #StandForTrees by writing a simple sql query to pass an important message to my SQL folks.

Copy and Paste below query into SQL Server query window → CTRL + T (Make the result window to text mode) → F5 (Execute)


--**Imp: Press CTRL + T to make the result window to text mode before executing this query.
SET NOCOUNT ON
SELECT
	SPACE(18 - LEN(REPLICATE(CHAR(60), t.a))) + REPLICATE(CHAR(62), t.a * 2 - 1)
FROM (SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NEWID())
	) AS a
FROM (SELECT 'SQLINDIA' AS b 
	UNION ALL 
	SELECT 'SQLINDIA' 
	UNION ALL 
	SELECT 'SQLINDIA')
AS t1
CROSS JOIN (SELECT 'SQLINDIA' AS c 
	UNION ALL 
	SELECT 'SQLINDIA' 
	UNION ALL 
	SELECT 'SQLINDIA')
AS t2)
AS t UNION ALL SELECT
	SPACE(15) + REPLICATE(CHAR(124), 5) + CHAR(13) + CHAR(10)
	+ SPACE(3) + REPLICATE(CHAR(126), 30) 
	UNION ALL 
	SELECT
	SPACE(11) + CAST(0x5354414E4420464F522054524545 AS varchar(100)) + CHAR(13) + CHAR(10) +
	CAST(0x534F2054484154204E4558542047454E45524154494F4E2043414E204745542041495220464F522046524545 AS varchar(100))

Note: Do not try to understand the query, there is no such rocket science logic in it 🙂

stand-for-trees-sql-server