sherbug1015
asked on
Padding a number with leading zero
I am making a folder cabinet table where the user can add up to 30 levels of folders
The table structure looks like the attached.
If my next record was a child of folderID 3. I would need the folderIDPath to equal 23.03.04 (4 would be the identity key of the new record going in)
DepartmentID.ParentID.Fold erID with leading zeros for ParentId/FolderID
Anyone have any idea how I can write this in SQL Server?
Thanks.
filecabinets.xlsx
The table structure looks like the attached.
If my next record was a child of folderID 3. I would need the folderIDPath to equal 23.03.04 (4 would be the identity key of the new record going in)
DepartmentID.ParentID.Fold
Anyone have any idea how I can write this in SQL Server?
Thanks.
filecabinets.xlsx
if nulls get in the way try this
RIGHT('00' + ISNULL(CONVERT(varchar,[nu mber_colum n],2),'00' ) ,2)
RIGHT('00' + ISNULL(CONVERT(varchar,[nu
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
RIGHT('00' + CONVERT(varchar,[number_co
change [number_column] to the column name needed