Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Import text data from Excel with apostrophe at start of column

$
0
0

I have an Excel 2010 sheet that I need to import into SQL Server 2008.  In one spreadsheet column some of the text values have a single apostrophe at the start (these are actually all numbers with 4 digits and no leading zeroes).  When I do the import into an SQL Server table with the data type for the column of nvarchar(255) it puts a null in any field that has the leading apostrophe.  It does the same thing if I make it an int field in the SQL Server table.  I tried making a new column in Excel with the expression “=Right(A2, 4)” and it dutifully copies in the leading apostrophe anyway if there is one.  I also tried copying the data and pasting it into a new column use Paste Special | Values and again it puts in the leading apostrophe if the original column has one.  I finally went in a ‘corrected’ the “Number stored as text” error and this worked but this is tediously slow.  Find and Replace also ignores leading apostrophes.

Is there any way to get it to ignore the leading apostrophe?

Thanks


Viewing all articles
Browse latest Browse all 24688

Trending Articles