Author Archives: MoonLightDBA

Change VLANS/ IP Addresses of a SQL Server failover cluster instance

  This has been performed in SQLServer 2012 SP3, A-P cluster setup on windows server 2012. These are virtual machines build on Hypervhosts. Requires a sysadmin/network admin for updating DNS or adding isci names to SAN In Active node: Go … Continue reading

Posted in SQL Server DBA Stuff | Tagged , , , | Leave a comment

TSQL to output result set in an email in a tabular format without showing number of rows affected

Hello, I was thinking of configuring an alert for our application for which the output is a resultset of a query displayed in an email. The alert was good but since it was a direct output of a query it … Continue reading

Posted in SQL Server DBA Stuff | Tagged , , , , | 1 Comment

TSQL to generate JSON insert script for a collection with name same as sql server table

Hello, I was trying to migrate a SQLServer database to a MongoDB database with SSIS and to do this the SSIS transform expects an empty row in each collection in mongodb. I found this challenging because I had 50+ tables … Continue reading

Posted in SQL Server DBA Stuff | Tagged , , , , , , , | Leave a comment

SQL Server 2012 SE Cluster: SAN Upgrade Steps

Hello every one. Hope all is well. Its been a while since my last post. Today I am going to write about SAN upgrade for one of my test sqlserver cluster instances. I am using SQL Server 2012 SE Active … Continue reading

Posted in SQL Server DBA Stuff | Tagged , , , , , , , , | 1 Comment

T-SQL to send email

Hello, Below piece of t-sql will help you send email. I use this in some test jobs whenever I don’t want to send unwanted emails to the entire DBA team. An instance of this is when I am testing some purge … Continue reading

Posted in SQL Server DBA Stuff | Tagged , , , , | Leave a comment

Function to get Business Hours

Hello, Its been a while since my last blog post. Today I am blogging about a function that I had to work on to calculate business hours. Per my requirement the start time is 8:30AM and end time is 17:30PM … Continue reading

Posted in SQL Server DBA Stuff | Tagged , , , , , | Leave a comment

Tsql script to select all columns from a table grouped by max column value

Hello, In this blog I would like to post the t-sql statement to select all columns from a table grouped by max value of a column. This is possible by using the row_number function. Below is the sample data for … Continue reading

Posted in SQL Server DBA Stuff | Tagged , , , , | Leave a comment