Tuesday, January 22, 2013

Book : SQL Server Window Functions

One of my favorite tool-set in Oracle database  is Analytical functions . I used it , wherever appropriate . Most of time , it has solved my problems , which otherwise been done by procedural logic ( aka PL/SQL ) .

Analytical functions has been implemented in Oracle since 1993 - almost  two decades.

You might wonder  ... the title says .... SQL Server .. and this guy talks about Oracle .

With the release of SQL Server 2012  ,  SQL Server has almost all the analytical functions as Oracle.

Currently , I am reading the book "Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions" [ Microsoft Press]. It is pretty interesting and easy read. This book has lot of new stuff for T-SQL developers.  I was surprised to see the name of Oracle Cheif Technogist name ( Tom Kyte ) in one of the chapters [ side notes - where the author mentions about the proposal of new analytical functionality].


I wish both Oracle / MS maintains the same terminology on these functions ( instead of calling it as "analytical " or " window" functions , settle on one nomenclature ) .

Wednesday, January 2, 2013

Encrypt Connections to SQL Server

By default , the connections to SQL Server are not encrypted.

C:\>sqlcmd -W
1>  Select  protocol_type , encrypt_option  from sys.dm_exec_connections;
2> go


protocol_type encrypt_option
------------- --------------
TSQL FALSE
TSQL FALSE


We  can use SSL to encrypt the connections using SQL Server  Configuration Manager . 
Here are the steps.

a)  Expand "SQL Server Network Configuration " in the left panel
b) Right Click on  the "Protocols for XXXX" ( where XXXX is the ServiceName ) and select Properties.
c) Select "Yes" in the "Force Encryption " in the "Flags" tab.
d) Select the certificate in the "Certificate" tab. ( Note : If you don't specify  the certificate , SQL Server uses the self signed certificate) .
e) Click OK and restart the service(s) 


To verify the changes , run the following SQL .


C:\>sqlcmd -W
1>  Select  protocol_type , encrypt_option  from sys.dm_exec_connections;
2> go
protocol_type encrypt_option
------------- --------------
TSQL TRUE
TSQL TRUE
TSQL TRUE
TSQL TRUE


Comments Welcome.