• I need to return as part of the SELECT Statement the Experian Score that is derived by comparing the score in the #ImportExperianDataTest Table it to a range in another Table ActionRatingDuns.

    CREATE TABLE #ImportExperianDataTest (

    ID int IDENTITY(1,1) NOT NULL,

    ExperianScore int NOT NULL,

    ActionRating VARCHAR (15))

    INSERT INTO #ImportExperianDataTest (

    ExperianScore )

    VALUES (40),(71),(85)

    SELECT *

    FROM #ImportExperianDataTest

    CREATE TABLE [dbo].ActionRatingDuns(

    [actionRatingID] [int] IDENTITY(1,1) NOT NULL,

    Min_Score int NOT NULL,

    Max_Score int NOT NULL,

    [actionRatingDesc] [varchar](250) NOT NULL,

    CONSTRAINT [PK_actionRatingDuns] PRIMARY KEY CLUSTERED

    (

    [actionRatingID] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [FG1]

    ) ON

    INSERT INTO ActionRatingDuns

    ([Min_Score],

    [Max_Score],

    [actionRatingDesc])

    VALUES (80,100,'Low Risk'),(50,79, N'Medium Risk'),(0,49,N'High Risk')

    ExperianScoreAction Rating

    80-100 Low Risk

    50-79 Medium Risk

    0-49 High Risk

    It basically Selects the ExperianScore and other columns and stores the Action rating in the #ImportExperianDataTest Table.

    How can I do this?

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/