Adding a new table to Replication in MSSQL Server without reinitializing the Snapshot

There are some prerequisites for Tables to be a part of replication:
It should have a PRIMARY KEYIt should have IDENTITY NOT FOR REPLICATION NOT NULL: If prerequisites are not met for Primary key you will see the following error:
Msg 14088, Level 16, State 1, Procedure sp_MSrepl_addarticle, Line 1539 [Batch Start Line 0] The table '[dbo].[T_YourTableNameHere]' must have a primary key to be published using the transaction-based method. Though NOT FOR REPLICATION FOR IDENTITY will not throw any error during the time you are adding the table to replication but it will start throwing errors once you will start inserting rows or data into the table and I am guessing you must have heard this earlier "prevention is better than cure".

Alright once prerequisites has been taken care of  this tasks can be accomplished using the following steps :
Create table in Publisher Node.Create table in all Subscriber Nodes.Use sp_addarticle to add and publish the new table in your public…

List of Questions I have been asked in Interviews

Note: If you are an interviewer and I have a interview scheduled with you in upcoming days or hours, please ask things which are not listed below so that I can have a opportunity to learn few more new things thanks ;)

This Page will be updated from time to time as I face new questions:
Do you know about System Pages GAM SGAM DCM ?Different modes available in Always on?Whats the difference between Synchronous and Asynchronous modes available?Which technology and version facilitates automatic page repairs in SQL Server?Difference between 2016 and 2012 version of SQL Server (New things that are available or absent).If latency is being observed in secondary replicas and transaction log on primary replica is full and not releasing space even after taking backup and shrinking and there is no open transactions what could be the possible reason and its resolution?What is the need of Bulk log recovery model apart from its minimally logged benefit for bulk operations?How did you optimized update…

T-Sql Script for Automating Replication Generation for all Stored Procedures in a SQL Server Database

This involves following steps:
Creating stored procedure named Create_Replication_SP using the code provided in this post. Please find the T-sql script below that can be used to create,configure and run replication for all stored procedures in a database automatically. Once stored procedure is in place all you have to do is provide the name of the database as the parameter as shown in example below:Use NameOfDatabasewhereSpIsCreated GO EXEC [Create_Replication_SP] @Database_Name='NameOfDatabaseHere'This will generate and Print a script in return in messages tab in SSMS. Copy the generated script and paste it in new query window and execute it and wait for its completion, progress gets tracked in Messages tab in Output window. What script does:
This creates Publication with nomenclature DatabaseName_SPor if you want a custom name you can pass the parameter @Publication_Name along with @DatabaseName (should be under 20 characters). Creates a snapshot agent Gets all the stored pro…

Adding Contact form within Blogger Contact Page

Let me be quick on this one :
This is 2 step process I am using Contempo template but things are pretty same for any blogger theme.
Getting the contact form widget: Add a contact form gadget to sidebar from layout section to get the contact form and then hide it from sidebar by using CSS: style="Display:None;" To do that jump to Contact form widget from Theme>> HTML Editor>>contact form widget and expand  <b:includable id='content'> Find this: <div class='contact-form-widget'> and replace it with this:
 <div class='contact-form-widget' style='display:none!important'>Moving the contact form to Page: Create a new contact page from pages section switch to HTML editor add the following html between the div tags already present there and publish it.
Note: Below code is coming from expanded content section of contact form widget from theme editor so in case you are facing some issues that's the place you should be lo…

How to make your own online Code Compiler Platform in 30 minutes

For this Demo Tute we will be showcasing just Python: Install Node.js from this will also install NPM on your Server\System.NPM will be used to install various packages given below to make this work: Install compileX using command given below on cmd:
npm i compilexInstall express using command given below on cmd:
npm i expressInstall body-parser using the command given below on cmd:
npm i body-parserInstall Python on your Server\System as this will be used by our web app to execute code. Set Python in Path variable so that you can execute it from anywhere from cmd without traversing directories again and again.Add code given below to notepad and save it as TestPython.js in some directory.
var express = require('express'); var path = require('path'); var app = express(); var bodyParser = require('body-parser'); app.use(bodyParser.urlencoded({     extended: true   })); app.use(bodyParser.json()); //compileX var compiler = require('compilex…

How to Automatically MSTSC or RDP into Windows Server without entering Password again & again

Like always will come directly to point:

This saves password in clear text in batch file so think before using it on a shared system.If this doesn't bothers you and its really necessary as your connection is too fluctuating go ahead and read below how you can do it.

This is a 2 part process : Create batch file with all the commands given below and save it as NameOfBatchScript.bat this name is used in VBScript so make sure you replace it accordingly.Create a VBScript file with commands  given below to load the batch file we created in above step without showing the mstsc yes no prompts, save this file with any name you like(May be your Jump Server Name is best Choice for its name in case you have multiple due to multiple clients) but make sure to save it with extension  as .VBSNote: Replace the DomainName, Username & Password accordingly also IP with Server name\IP of server you are trying to connect if in same domain or with its FQDN if not in below scripts in SET …

Query to Expand and List All logins within a SQL Server Group

This query will get the details of user logins with in Active directory security group in expanded format which is not available by default in SSMS, this will iterate over all the user logins under Security section and expand and list the users within the group if there are any along with all other logins:
For example DBA team has 10 members who are part of Group Name DBA_GROUP and this Group is added in SQL Server logins so it will list the members with in DBA_GROUP as well (like DOMAIN\DBA1 DOMAIN\DBA2 and so on )instead of just listing DBA_GROUP.

SET NOCOUNT ON CREATE TABLE ##TEMPHOLDUSERS       (        AccountName NVARCHAR(MAX),        AccoutnType NVARCHAR(MAX),        Privilege NVARCHAR(MAX),        MappedLoginName NVARCHAR(MAX),        PermissionPath NVARCHAR(MAX)       ) DECLARE @id NVARCHAR(MAX) DECLARE @getcoinid  CURSOR SET @getcoinid   = CURSOR FOR SELECT name FROM sys.server_principals WHERE TYPE = 'G' AND name NOT LIKE '%$%' and name NOT LIKE 'NT%…

Redirecting all old url to home page or any other page in blogger using script

Adding a 301 redirect for every url which has year older then the value we are setting in our script:

So why this was needed ?

Recently I found in google search console that lot of Page not found errors are triggering for my site and when I looked at the links it was clear that the errors are because the domain was owned by someone else before I got it and google crawlers were still trying to find posts and pages which were published by previous owner.

Although there is a option to create a redirect for links in blogger dashboard but doing that for every single url each and every time was too much of work and also this was a blind game as we don't know for which url the error will trigger next until it was being logged in google search console: So here is quick summary for what I did followed by script and the Long explanations.

Quick Summary: Get current Url user is visiting on my site>Extract Year part from it>If YearFromUrl(is less then)<YearIStartedWritingPostsOnMySite…