Feeds:
Posts
Comments

Archive for August, 2020

‘Verbose Truncation Warnings’ is one of the greatest features launched in SQL Server 2019. I have been waiting for this feature for quiet a long time because troubleshooting was a nightmare in such cases. This feature can literally save a lot of time while importing, inserting & updating huge amount of data. Let me cut short the story.

Let me create a sample database and a table to demonstrate the issue in earlier version (Any older version than SQL Sever 2019) of SQL Server Step by Step.

Step 1 : 

Let’s create a database and set the compatibility to 140 (SQL Server 2017).

USE [master]
GO
--Create Sample Database
CREATE DATABASE [Sample DB 2017]
GO
ALTER DATABASE  [Sample DB 2017]
SET COMPATIBILITY_LEVEL = 140  -- SQL Server 2017
GO

Step 2 : 

Let’s create a sample table and insert few records.

USE [Sample DB 2017]
GO
CREATE TABLE [dbo].[tbl_Color](
	[Color ID] [int] IDENTITY(1,1) NOT NULL,
	[Color Name] [varchar](3) NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[tbl_Color]
           ([Color Name])
     VALUES
	       ('Red'),
	       ('Blue'),
	       ('Green')
GO
--OUTPUT

 

Now, you should not worry anymore because this issue has been fixed in SQL Server 2019. 

Let me demonstrate step by step. How it’s fixed in SQL Server 2019 and make it very simple for us.

Step 1 : 

Let’s create a database in SQL Server 2019 by default the compatibility is 150.

USE [master]
GO
--Create Sample Database
CREATE DATABASE [Sample DB 2019]
GO

Step 2 : 

Let’s create a sample table and insert few records

 
USE [Sample DB 2019]
GO
CREATE TABLE [dbo].[tbl_Color](
	[Color ID] [int] IDENTITY(1,1) NOT NULL,
	[Color Name] [varchar](3) NULL
) ON [PRIMARY]
GO

INSERT INTO [dbo].[tbl_Color]
           ([Color Name])
     VALUES
		   ('Red'),
		   ('Blue'),
		   ('Green')
GO
--OUTPUT

Verbose Truncation Warnings-2

Read Full Post »