Link to home
Start Free TrialLog in
Avatar of PeterFrb
PeterFrbFlag for United States of America

asked on

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
Avatar of pivar
pivar
Flag of Sweden image

Hi,

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

/peter
ASKER CERTIFIED SOLUTION
Avatar of pivar
pivar
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PeterFrb

ASKER

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
Excellent.  I had no idea that this feature exists.
Thank you.  ~Peter
You're welcome

/peter