Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Importing from Access

Author  Topic 

dlhall
Starting Member

8 Posts

Posted - 2009-09-30 : 11:17:23
I am importing a table from Access 2003 into SQL 2000. One column is causing a small issue I cannot seem to solve. In Access, this is a number field, and is 4 characters long and some entries have leading zeros, which display in the Access table. After performing the import DTS, the field in SQL has dropped any leading zeros. I have designated this field to be a varchar type of 4 characters.
How can I keep the leading zeros from Access...or force the imported field in SQL to be 4 digits WITH leading zeros?

Thanks to anyone...

Ifor
Aged Yak Warrior

700 Posts

Posted - 2009-09-30 : 13:24:50
DECLARE @StringNum varchar(4)
SET @StringNum = '4'
SELECT @StringNum
SET @StringNum = RIGHT('000' + @StringNum, 4)
SELECT @StringNum
Go to Top of Page

dlhall
Starting Member

8 Posts

Posted - 2009-09-30 : 15:57:44
Sorry, but I guess I do not understand how this is a part of a DTS package running daily. Is there something in the data transformation I am missing?
Go to Top of Page
   

- Advertisement -