Forum Replies Created

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

  • RE: Update Temp table where the column names are unknown

    Jeff Moden (12/26/2013)


    This will lead to some pretty miserable performance on top of it all... it makes for a 100% non-SARGable query. You could have a thousand index on...

  • RE: Update Temp table where the column names are unknown

    DECLARE @cmd VARCHAR(8000)

    SELECT 'UPDATE ##TempTable

    SET [' + ApplicationName +'] = (SELECT SUM(columName)

    FROM RegularTable

    WHERE FORMAT(RegularTable.Date,''MM/yyyy'') = FORMAT(##TempMonths.x,''MM/yyyy''))

    AND ApplicationName = ' + ApplicationName +' '

    PRINT @cmd

    EXEC (@cmd)

    Thanks! I got it to work...

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