[Solved] Inserting Multiple values of int type into one column


Possible this be helpful for you –

DECLARE @temp TABLE (ID INT)

-- For 2008 and higher

INSERT INTO @temp (ID)
VALUES (1), (2), (3)

-- For 2005 and higher

INSERT INTO @temp (ID)
SELECT ID
FROM (
    SELECT ID = 4
    UNION ALL
    SELECT 5
    UNION ALL
    SELECT 6
) t

SELECT * 
FROM @temp

Update (comment @Sivakumar: “1,19 is not an integer. It is a varchar.”):

DECLARE @temp TABLE (txt varchar(500))

INSERT INTO @temp (txt)
VALUES ('1,19'), ('2,18')

SELECT t.c.value('.', 'INT')
FROM (
    SELECT txml = CAST('<t>' + REPLACE(txt, ',', '</t><t>') + '</t>' AS XML)
    FROM @temp
) a
CROSS APPLY txml.nodes('/t') AS t(c)

2

solved Inserting Multiple values of int type into one column