EDIT:
I am changing the column data type to Varchar, should offer a job, the answer will be saved
Full story: I get data for a person with an associated temporary number for each person 5 digits long, I process this information, and then send the variables to a stored procedure that processes the insertion of this data. When sending variables to a stored procedure, I seem to lose any prefix 0.
For example:
Number sent to stored number Proc - Number actually inserted column
12345 - 12345
01234 - 1234
12340 - 12340
This only happens for numbers with a 0front. Value, if I received:
00012it will be inserted as12
Is there a way in which I could either update the column always 0pad left to a fixed number, that is, if we got it 12, it would automatically produce a value 00012.
OR
Is there a way to do this with a variable when it is received by the stored procedure before the variable is inserted into the table. Sort of:
SET @zeroPaddedFixedNum = LeftPad(@numberRecieved, '0', 5);
In addition, I now need to stop any numbers from inserting and updating all current incorrectly obsolete numbers. Any suggestions?
Perhaps this is just my Google ability, which failed, but I tried to find numerous pages.
source
share