Database table :CREATE TABLE [dbo].[footbel]( [divisie] [varchar](50) NULL, [datum] [char](10) NULL, [hour] [datetime] NULL, [home] [varchar](100) NULL, [away] [varchar](100) NULL, [reshome] [smallint] NULL, [resaway] [smallint] NULL, [status] [char](3) NULL, [md] [varchar](50) NULL, [regnumberhome] [char](6) NULL, [regnumberaway] [char](6) NULL) ON [PRIMARY]GOThe database is filled with a bulk insert from a csv file.When I look up the table (actually I want to do an Update) I get the following results:SELECT TOP (200) regnumberhome, RIGHT('00000' + RTRIM(LTRIM(regnumberhome)), 5) AS regnrH, regnumberaway, RIGHT('00000' + RTRIM(LTRIM(regnumberaway)), 5) AS regnrA, RIGHT('00000' + RTRIM(LTRIM(regnumberaway)), 6) AS regnr6FROM footbel(partial) result :3855 03855 9446 9446 094469567 09567 683 0683 006839446 09446 201 0201 00201683 00683 2982 2982 029827436 07436 3554 3554 035543182 03182 30 0030 000304801 04801 599 0599 005993554 03554 9328 9328 09328In the second column right(rtrim(ltrim(regnumberhome)),5) is the (correct) Number, 5 digits padded 0 to the left of the first database column.However, for the third column, the same sequence of right(rtrim(ltrim()),5) gives only 4 digits !I have to add an extra digit (right(rtrim(ltrim()),6)) to get the 5 numbers back !!!Any advice on the matter ?
Product Language
Version
Category
Operating System
Operating System Language
Steps to Reproduce
Actual Results
Expected Results
Platform
Virtualization
Please wait...