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)
 leading zeros missing on nvarchar field

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-01-31 : 09:00:47
Stacey writes "I had a SQL column in a table that was converted from datatype 'numeric' to datatype 'nvarchar' - this did not affect my application adversely as far as i can tell; however, when my .asp page runs a stored procedure that inserts records to this table, the records are stripped away of the leading zeros. (ie, "00000009" is only inserted as "9"). I've commented out any javascript validation running and tested inserting directly onto the table itself. When I insert a record directly to the table, that field --will-- hold the leading zeros. What's up? Does .asp do that automatically?"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-31 : 09:07:19
If you use integer data type to hold that data in asp page there is changes leading zeroes get truncated. Use String data type.

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -