HALP urgent fix my code

  • i get this code here and it is OK

    but my problem is how can i put the ok code

    here

    ---------------

    SELECT dbo.Table1.Field1, dbo.Revenue.Services

    FROM dbo.Revenue INNER JOIN

    dbo.Table1 ON dbo.Revenue.Services = dbo.Table1.Field1

    WHERE (dbo.Revenue.Services IN (1, 2, 3, 4))

    ORDER BY dbo.Table1.Field1

    ------------------------------------------

    the ok code with the variable thet you help my

    -----------------------

    DECLARE @inmhlka VARCHAR(20)

    DECLARE @exec_stat VARCHAR(100)

    SET @inmhlka= '3,4'

    SET @exec_stat = 'SELECT Services FROM dbo.Revenue WHERE CONVERT(VARchar (20),Services) IN (' + @inmhlka + ');'

    EXEC (@exec_stat)

    ---------------------------

    i wont to put the first code in the second code

    help my to make the code complete

    thnks agin ilan

  • DECLARE @inmhlka VARCHAR(20)

    DECLARE @exec_stat VARCHAR(100)

    SET @inmhlka= '3,4'

    SET @exec_stat = 'SELECT dbo.Table1.Field1, dbo.Revenue.Services FROM dbo.Revenue INNER JOIN

    dbo.Table1 ON dbo.Revenue.Services = dbo.Table1.Field1 WHERE CONVERT(VARchar (20),Services) IN (' + @inmhlka + ');'

    EXEC (@exec_stat)

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

    http://www.dkranch.net

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply