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.
| Author |
Topic |
|
jcb267
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-03-20 : 14:22:05
|
| I am importing data from Microsoft Excel. One of the columns is a record number and is 6 digits in length. When I run the import tough, it is cutting off the leading zero. Can anyone help with that? |
|
|
bmatthews
Starting Member
8 Posts |
Posted - 2009-03-20 : 15:37:56
|
| Hello! I am assuming you are importing your sheet into SQL Server 2k/2k5? If so, then after you choose your source/destination, you should be able to go in and edit your sheet's columns and make sure that your datatypes are set correctly. If you have any questions regarding this, please let me know.If are doing this through a SQL script though, I would yet again doublecheck your datatypes. Would you be able to post the code if so? |
 |
|
|
jcb267
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-03-20 : 16:20:43
|
quote: Originally posted by bmatthews Hello! I am assuming you are importing your sheet into SQL Server 2k/2k5? If so, then after you choose your source/destination, you should be able to go in and edit your sheet's columns and make sure that your datatypes are set correctly. If you have any questions regarding this, please let me know.If are doing this through a SQL script though, I would yet again doublecheck your datatypes. Would you be able to post the code if so?
It is in SQL 2005. I am actually not the one doing it.....people in my IT department are doing it so I will not be able to post the code. I am just wondering if what they are telling me is correct?? |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-20 : 17:30:28
|
| May be the detaination column is numeric,int,float. That case it'll trim the leading zeroes. You'll need varchar data type to save leading zeroes. Numeric data types will always trim leading zeroes. |
 |
|
|
jcb267
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-03-21 : 10:00:23
|
quote: Originally posted by sakets_2000 May be the detaination column is numeric,int,float. That case it'll trim the leading zeroes. You'll need varchar data type to save leading zeroes. Numeric data types will always trim leading zeroes.
OK, Thanks. |
 |
|
|
|
|
|
|
|