CREATE TABLE #tab(col VARCHAR(1000)); INSERT INTO #tab V...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Japanese Language Meta

Q&A about the site for students, teachers, and linguists wanting to discuss the finer points of the Japanese language

CREATE TABLE #tab(col VARCHAR(1000));

INSERT INTO #tab
VALUES ('0001'), ('001'), ('0002'), ('01');

DECLARE @number INT = 1;

SELECT *
FROM #tab
WHERE LEFT(col, @number) = REPLICATE('0', @number);

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results