awesome solution Cadavre!
only thing i would do is clean up the presentation with REPLICATE to get the zeros, and maybe just a simple not like '%[^0-9]%' ; what do you think of this?
IF object_id('s_sumar_s') IS NOT NULL
BEGIN
DROP TABLE s_sumar_s;
END;
CREATE TABLE s_sumar_s (
ID INT IDENTITY(1,1) NOT NULL,
faux_number VARCHAR(116) CONSTRAINT CK_faux_number CHECK (RIGHT(REPLICATE('0',120) + faux_number,116) NOT LIKE '%[^0-9]%'),
useful_faux_number AS RIGHT(REPLICATE('0',120) + faux_number,116)
);
INSERT INTO s_sumar_s(faux_number)
SELECT '1267'
UNION ALL SELECT '231'
UNION ALL SELECT '428973681279460182436';
--this should fail against the constraint.
insert into s_sumar_s(faux_number) values ('Alphabits42')
SELECT * FROM s_sumar_s ORDER BY useful_faux_number ASC;
Lowell