Posts Tagged ‘Delete Horizontal White Space’

Whenever we do data migration from any old systems to new / upgraded systems, we usually receive data in different formats (text files, cvs, excel etc.) to insert into SQL Server.  Sometimes, due to the different formats, the additional white spaces accompany the data. These additional white spaces create problems later in the application. In this article, I will show you how to view the white spaces and a simple solution to remove them from the data, horizontally.

Let me explain this, step by step.

Step 1 :
Copy the data from any format  (text files, cvs, excel etc.) to SQL Server editor (new query window). In my case, I will copy the data from text file and paste it into SQL Server editor.

Given below is the image.

remove white space.1.1

Step 2 :
Now, you can see that the data is not in a proper order, obviously because the white spaces have accompanied the data . Let’s view the white spaces in the data using SQL Server editor.
Click on the Edit menu select Advanced and click on View White Space.
As shown in the given below image.

remove white space.1.2

Given below is the image showing white spaces.
remove white space.1.3

Step 3 :
Now, select the data from where you need to remove the white spaces horizontally (Note : If you want to remove white space from one line or from either left side or right side, just select that particular area as shown in the image below).

remove white space.1.3.1

Step 4 :
Once you select the data to remove horizontal white space, click on the Edit menu, select Advanced and click on Delete Horizontal White Space, as shown in the picture below.

remove white space.1.4

Step 5 :
Now, you can see, in less than seconds the white spaces are removed from your data without any effort.

remove white space.1.5

Let me know how you usually remove the white spaces horizontally from the data.

Read Full Post »