• hi

    After creating the tally table, used this, but gives me a error on the select

    INSERT INTO BC (ref,design,codigo)

    values ("001","teste", SELECT '001',

    'teste',

    RIGHT( '000' + CAST( n AS varchar(4)), 4)

    FROM dbo.Tally

    WHERE n <= 9999)

    thanks for you reply