MS ACCESS TO SQL SERVER

  • Can someone please help me convert this script to run is SQL?!

    Colum 'Extension' contains some 10 000 number and I want to add a '0' to numbers below 50.

    SELECT dbo_MAIN.Campus, dbo_MAIN.Extension, dbo_MAIN.Name, dbo_MAIN.Initial, dbo_MAIN.First, IIf([Extension]<50,"0" & [Extension],[Extension]) AS Extn, dbo_MAIN.Node,

    FROM dbo_MAIN INNER JOIN dbo_CRIT ON (dbo_MAIN.Dept = dbo_CRIT.DEPT) AND (dbo_MAIN.DivN = dbo_CRIT.DIV_NAME);

  • Replace IIf([Extension]<50,"0" & [Extension],[Extension])

    with CASE WHEN [Extension]<50 THEN '0' + [Extension] ELSE [Extension] END

    Should be all right then.

    _____________
    Code for TallyGenerator

  • Thanks its workssss

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

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