• Can I suggest you start with the obvious and chose appropriate data types for your columns?

    CREATE TABLE #tbl_ChannelViewCost

    (

    rcc_id NUMERIC(10,0),

    activity_dataset_id NUMERIC(10,0),

    profit_centre_id NUMERIC(10,0),

    channel_dataset_id NUMERIC(10,0),

    customer_dataset_id NUMERIC(10,0),

    product_category_dataset_id NUMERIC(10,0),

    channel_cost NUMERIC(22,8),

    driver_id NUMERIC(5,0),

    )

    Why are you using NUMERIC with 0 scale? That's 9 bytes for each one.

    6 columns x 9bytes that's 54 bytes + 5 for the smaller NUMERIC

    3559048 rows X 59 bytes = 231338120 bytes = 200MB

    Changing these columns to INTs will cut the size in half:

    3559048 rows X 28 = 99653344 bytes = 95MB

    It's a start....

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

    It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
    David Edwards - Media lens[/url]

    Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
    Howard Zinn