T SQL Date format convert function

Here is the script which can give you SQL Server file IO Statistics for each file and file group. Using this data you can find out sql server read/write performance of your disks. DECLARE @TotalIO BIGINT, @TotalBytes BIGINT, @TotalStall BIGINT …

Measure the I/O load on database files and file group using fn_virtualfilestats Read more »

T SQL Date format convert function

Northwind is my favorite database for trying out sample T-SQL scripts because of its simplicity. Here is the full script you can just copy/paste and run in SSMS (for sql server) or SQL Developer (for oracle) to create Northwind database …

Northwind Database Creation Script for SQL Server and Oracle Read more »

T SQL Date format convert function

Just came across very interesting scenario where I had to consume JSON data in SQL Server. Yes I can write C#/VB.net code and load JSON to SQL Server and go from there but what if I have no expertise in …

Consuming JSON data in SQL Server and SSIS, convert JSON to XML Read more »

T SQL Date format convert function

If you ever try to update several millions of record in single Update statement then think several times because it can cause real pain. Disadvantage of single Update statement is … Its considered as single transaction and it doesn’t commit …

How to update large number of records in batch Read more »

T SQL Date format convert function

Here is reusable function which can be used to format SQL dateTime to any format like C# or VB.net DROP FUNCTION dbo.fnFormatDate GO CREATE FUNCTION dbo.fnFormatDate (@Datetime DATETIME, @FormatMask VARCHAR(100)) RETURNS VARCHAR(100) AS BEGIN DECLARE @StringDate VARCHAR(100) SET @StringDate = …

T-SQL Date Format Function – fnDateFormat like .net Read more »