Yak Posting Veteran
Posted - 10/13/2012 : 17:29:04
| I have a table with 3418 records.
The table has a column for ITEMNMBR. The ITEMNMBR should have 12 characters.
In my table, I have 3157 records where the ITEMNMBR has only 11 characters. Basically my text file (used to insert records) 'dropped' a leading zero for the ITEMNMBR.
Here a sample of what's in table:
All these values need to be updated to be:
Basically I want an update statement that will look at the value in the ITEMNMBR column - if it has 11 characters - add '0' (to the first space) if it has 12 characters - leave it alone.
Here's an example of my insert statement:
INSERT INTO [RBI].[dbo].[IV10303]
When run - this inserted '31568486340' - and yes my insert came from Word - into NotePad - then copied into query window. Visually the leading zero is visible - but obviously SQL didn't see it. I'm wondering if I have a quick update fix or if I have to start over...