Skip to content

Instantly share code, notes, and snippets.

View rajanand's full-sized avatar
🎯
Focusing

Rajanand Ilangovan rajanand

🎯
Focusing
View GitHub Profile
@rajanand
rajanand / reciprocal.sql
Created February 13, 2022 06:53
How to calculate total travel hours between city x and y and vice versa?
/*-------------------------------------------
2022-02-01
Rajanand Ilangovan
https://blog.rajanand.org/how-to-calculate-total-travel-hours-between-city-x-and-y-and-vice-versa
How to calculate total travel hours between city x and y and vice versa?
--------------------------------------------*/
USE demo;
if object_id (N'dbo.travel_detail', N'u') is not null
/*-------------------------------------------
2022-02-13
Rajanand Ilangovan
https://blog.rajanand.org/how-to-generate-permutations-in-sql
How to generate permutations in SQL Server?
--------------------------------------------*/
use demo;
go
@rajanand
rajanand / datatype.r
Created March 10, 2018 06:18
Introduction to R programming
x <- 1.5
class(x)
#> [1] "numeric"
x <- 1
class(x)
#> [1] "numeric"
#Uppercase L should be suffixed with the number to assign integer datatype.
x <- 1L
@rajanand
rajanand / Introduction to R.md
Last active December 8, 2017 04:12
Introduction to R

Introduction to R

Basics

Comments

In R programming # is used to comment a code. If a particular line is commented in a script, when the script is executed, anything after a # will be ignored. There is no separate multi-line (a block comment) comments unlike other languages like HTML, SQL, JavaScript, Java etc.

#Calculate 5 + 7

Arithmetic

R can be used as a simple calculator. Consider the following arithmetic operators.

@rajanand
rajanand / close_pdw_sessions_to_restore_the_database.sql
Created April 16, 2016 17:13
Parallel Data Warehouse (PDW): To close all the session connected to the database and then drop the database in PDW (Microsoft APS).
-- 1. Get all the session id for the database.
-- 2. Kill all the session id.
-- 3. Drop database
--================================================
DECLARE @TOTAL_CONNECTIONS INT;
DECLARE @INDEX INT;
DECLARE @RESTORE_DB_NAME VARCHAR(100);
DECLARE @SQL_KILL_SESSION NVARCHAR(1000);
DECLARE @SQL_DROP_DB NVARCHAR(1000);
@rajanand
rajanand / factorial.py
Last active September 8, 2015 18:45
To find factorial in python using recursive function
#factorial in python using recursion
# visualize: http://go.rajanand.org/python_factorial_function
def fact(n):
if n==1:
return n
return n*fact(n-1)
print fact(5)

Keybase proof

I hereby claim:

  • I am rajanand on github.
  • I am rajanand (https://keybase.io/rajanand) on keybase.
  • I have a public key whose fingerprint is CA06 4C4C 6EC5 654B B19D 6915 D34D E539 6E07 91B6

To claim this, I am signing this object:

@rajanand
rajanand / Number of active connections
Created June 9, 2014 17:13
To find the number of active connections for each database in sql server.
--To find the no. of active connections in sql server
SELECT db_name(dbid) as database_name, loginame, count(dbid) as no_of_connections
FROM sys.sysprocesses
WHERE spid > 50
GROUP BY dbid, loginame
@rajanand
rajanand / datatype_counts.sql
Created February 9, 2014 18:49
To find the total counts of data types of the columns in all the databases. - SQL Server
--------------------------------------------------------------------------------------------
--To find the total counts of data types of the columns in all the databases. - SQL Server 2012.--
--------------------------------------------------------------------------------------------
USE tempdb
-- Result Table
CREATE TABLE DataTypeDetails (
DataBaseName VARCHAR(30)
,IMAGE INT
,XML INT
/*
==============================================
CSS3 ANIMATION CHEAT SHEET
==============================================
Made by Justin Aguilar
www.justinaguilar.com/animations/
Questions, comments, concerns, love letters: