• EXEC Stored_procedure1 ('abc')

    EXEC Stored_procedure1 ('123')

    EXEC Stored_procedure1 ('abc112')

    Yes. The core of the logic is this:

    CASE WHEN <string_value> LIKE '%[^0-9]%' THEN <string> ELSE <int> END

    For example:

    SELECT

    data,

    CASE WHEN data LIKE '%[^0-9]%' THEN 'string' ELSE 'int' END AS type

    FROM (

    SELECT 'abc' AS data UNION ALL

    SELECT '123' UNION ALL

    SELECT 'abc112'

    ) AS test_data

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".