SQL Strip leading zeros

 

DECLARE @a VARCHAR(10) = '1234'
DECLARE @b VARCHAR(10) = '001234'
SELECT SUBSTRING(@a, PATINDEX('%[^0]%', @a+'.'), LEN(@a)),   SUBSTRING(@b, PATINDEX('%[^0]%', @b+'.'), LEN(@b))     


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences