We help IT Professionals succeed at work.

Don't suppress leading zeros from linked server to text files

In SQL Server 2008, I have a linked server to a directory containing comma-separated text files.  The files contain fields that have leading zeros in them that constitute account numbers, i.e., "000025", and the leading zeros are intended as part of the number.  As a linked server to a directory, I can see the tables, but I can't set the field types (see image below).  

What I suspect is happening is that SQL Server sees numeric values and pre-emptively classifies the field as a number, and I am wondering if I can specify to have SQL Server recognize the field as an nvarchar, so as not to suppress leading zeros.

Thanks, ~Peter Ferber

NoFieldDefinitions-In-LinkedServ.bmp
Comment
Watch Question

Commented:
Hi,

Have you created a schema.ini file in the textfile folder?

/peter
PeterFrbData anslyst, tableau visualization developer, vb certified

Author

Commented:
I'm unfamiliar with schema.ini, but it sound exactly like what I need.  Stand by: I will try it this morning and report on my findings.
~Peter
PeterFrbData anslyst, tableau visualization developer, vb certified

Author

Commented:
Excellent.  I had no idea that this feature exists.
Thank you.  ~Peter

Commented:
You're welcome

/peter