SSIS- How to Redirect Duplicate Records In SSIS Or Remove Duplicate Records...
Scenario:We need to load data from Flat file source but we want to redirect all duplicate records to Audit table or File with count and load only records which are unique to our destination...
View ArticleSSIS - How To Use Script Component AS Source [Generate Numbers In Data Flow]
Scenario:We want to generate Numbers from 1-99 inside Data Flow Task without using any Source such as OLE DB or File.Solution:We can use Script Component Transformation as Source and generate numbers....
View ArticleSSIS - How To Unzip .Zip Files In SSIS [ How To Use Execute Process Task In...
Scenario:We download .zip file from FTP site to our computer and then we need to unzip this folder and load all the files in folder to our destination tables.Solution :After downloading the .zip file...
View ArticleTSQL - How To Check When Object ( Table, Stored Procedure, Trigger etc) was...
Scenario: We as SQL Server developers send our DDL Scripts ( Add New Column, Drop some column from table, or Alter Stored Procedure) to DBA. After deployment we verify those changes and sometime it...
View ArticleTSQL - How To Check If Column Exists for SQL Table/ View in Database
On daily basis, we come across this scenario when we have to find out if a column exists fora Table or View in Database. Specially if we are debugging SQL Server Reports/An application,we take a column...
View ArticleTSQL - How to Find duplicate records in a SQL Server Table
A very common question asked to TSQL Developers is "How will you find duplicate records in a table?" and also as developer we encounter this situation all the time. Here are couple of ways to find the...
View ArticleTSQL - How To Delete All Duplicate Records From a SQL Server Table
Here are couple of ways to delete duplicate records from a SQL Server table.--Prepare Sample DataUSE TestDBCREATE TABLE dbo.Customer( ID INT, FirstName VARCHAR(100),LastName VARCHAR(100),Age...
View ArticleTSQL - How To Keep One Record From Duplicate Records and Remove All Of Others...
We have a SQL Server Table from which has duplicate records. We want to keep only one records from duplicate records and delete all others.We can use Common Table Expressions ( CTE) with Row_Number()...
View ArticleSSIS - How To Execute Batch File By Using SSIS Package
Scenario:We have created a batch file that copies all the files from Source folder to Destination folder. We want to execute this batch file in SQL Server Integration Services (SSIS)...
View ArticleTSQL- How To Find The Size Of a SQL Server Table
Here are the two ways to find the size of a SQL Server table1-- Right Click on the table and then go to the Properties. Then Click on Storage Tab and you will be able to see the size of TableFig 1-SQL...
View ArticleTSQL- How To Reset Identity Column Value in SQL Server Table
Let's start with understanding the Identity property first and then we can proceed to step,how can we reset it? Create a SQL Server Table with Identity Column by using below scriptUSE TESTGOCREATE...
View ArticleSSIS- How To Convert Blank Into Null In SSIS
Scenario:We are reading data from Flat File Source in our SQL Server Integration Services (SSIS) Package. Some of the values for Address column are coming as Blank. We want to convert those blank...
View ArticleSSIS - How To Insert Data Into a SQL Server Table with Identity Column
Scenario:We have dbo.Customer table in our SQL Server database.The ID column is identity column. We need to load the data from Flat File Source but want to insert the values in ID column from the...
View ArticleDBA - Permissions To Execute SQL Server Profiler
Below code can be used to provide/revoke Permissions to user to run SQL Server Profiler.USE MASTERGOGRANT ALTER Trace TO [DomainName\UserName]--Grant Permission To Aamir To Run ProfilerGRANT ALTER...
View ArticleDBA - Backup All TDE Certificates For All Databases ON Sql Server
When we try to de-attach a database on which TDE is enabled and try to restore, we get this error "Cannot Find Server Certificate with Thumbprint", We have to take the backup of certificate from...
View ArticleDBA - How To Get The Size of All Databases on SQL Server
Here is code that can be used to get the size of Data File (MB), Log File (MB) and Total Size of Database in GB on SQL Server.SELECT DBName, DataFile AS DataFileSizeInMB,...
View ArticleDBA- Generate Script To Bring All User Databases Offline in SQL Server
Quickly generate script to bring all SQL Server Databases offline.SELECT 'ALTER DATABASE ['+name+'] SET OFFLINE WITH NO_WAIT'+CHAR(10)+' GO'FROM MASTER.sys.databasesWHERE name NOT IN...
View ArticleDBA- Generate Script To Bring All User Databases Online in SQL Server
The below query can be used to generate scripts to bring SQL Server Databases from Offline state to Online.SELECT 'ALTER DATABASE ['+name+'] SET ONLINE'+CHAR(10)+' GO' FROM MASTER.sys.databasesWHERE...
View ArticleSSIS - How To Validate Excel Header Against Definition Table
Scenario: We get Excel File on daily basis, we want to validate the Header against our definition table before start loading. If Header does not match with our definition , we will strop the execution...
View ArticleDBA - How To Disable Transparent Data Encryption (TDE) On SQL Server Database
To disable Transparent Data Encryption (TDE) on SQL Server database, below code can be used.USE MASTERGOALTER DATABASE DatabaseNameSET ENCRYPTION OFFGOUSE DatabaseNameGODROP DATABASE ENCRYPTION KEYGO
View Article