Continuation of: Execution Plans not the same

  • I could not postto the previous Topic I had started. Not sure why.

    Original query is:

    SELECT

    CHF.CONTACT_WID , COUNT(DISTINCT CHF.SOURCE_WID) , COUNT(DISTINCT CASE WHEN POH.OFFER_WID IS NULL THEN 0 ELSE POH.OFFER_WID END) - SUM (CASE WHEN (POH.OFFER_WID = 0 OR POH.OFFER_WID IS NULL) THEN 1 ELSE 0 END)

    FROM

    W_CAMP_HIST_F CHF LEFT OUTER JOIN W_SRC_OFFR_H POH ON CHF.SOURCE_WID = POH.SOURCE_WID ,

    W_PARAM_G PARAM

    WHERE

    CHF.CONTACT_WID > 0 AND CHF.SOURCE_WID> 0 AND (CHF.ETL_PROC_WID = PARAM.ETL_PROC_WID OR POH.ETL_PROC_WID = PARAM.ETL_PROC_WID) GROUP BY CONTACT_WID

    Here are the table definitions for the 3 tables:

    CREATE TABLE [dbo].[W_CAMP_HIST_F](

    [ACCNT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__ACCNT__787EE5A0] DEFAULT (0),

    [CALL_STATUS_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CALL___797309D9] DEFAULT (0),

    [CAMPAIGN_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CAMPA__7A672E12] DEFAULT (0),

    [CAMP_OWNER_ORG_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CAMP___7B5B524B] DEFAULT (0),

    [CAMP_PARTNER_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CAMP___7C4F7684] DEFAULT (0),

    [COMPLETED_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__COMPL__7D439ABD] DEFAULT (0),

    [CONTACTED_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CONTA__7E37BEF6] DEFAULT (0),

    [CONTACT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CONTA__7F2BE32F] DEFAULT (0),

    [CREATED_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CREAT__00200768] DEFAULT (0),

    [DATASOURCE_NUM_ID] [numeric](10, 0) NOT NULL,

    [ETL_PROC_WID] [numeric](10, 0) NOT NULL,

    [INTEGRATION_ID] [nvarchar](30) NOT NULL,

    [ROW_WID] [numeric](10, 0) NOT NULL,

    [SEGMENT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__SEGME__01142BA1] DEFAULT (0),

    [VENDOR_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__VENDO__02084FDA] DEFAULT (0),

    [WAVE_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__WAVE___02FC7413] DEFAULT (0),

    [COMPLETED_DT] [datetime] NULL,

    [CONTACTED_FLG] [nchar](1) NULL,

    [NUM_ATTEMPTS] [numeric](10, 0) NULL,

    [NUM_DAYS_TOCONTACT] [numeric](10, 0) NULL,

    [KEY01] [nvarchar](30) NULL,

    [KEY02] [nvarchar](30) NULL,

    [KEY03] [nvarchar](30) NULL,

    [KEY04] [nvarchar](30) NULL,

    [KEY05] [nvarchar](30) NULL,

    [KEY06] [nvarchar](30) NULL,

    [KEY07] [nvarchar](30) NULL,

    [SOURCE_CODE] [nvarchar](75) NULL,

    [X_MSG_BNCD_STAT_CD] [nvarchar](30) NULL,

    [X_MSG_OPEN_TS] [datetime] NULL,

    [BNCE_REASON_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__BNCE___03874F4F] DEFAULT (0),

    [BNCE_TYPE_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__BNCE___047B7388] DEFAULT (0),

    [CAMP_END_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CAMP___056F97C1] DEFAULT (0),

    [CAMP_LNCH_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CAMP___0663BBFA] DEFAULT (0),

    [CAMP_ST_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CAMP___0757E033] DEFAULT (0),

    [CON_OUTCOME_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__CON_O__084C046C] DEFAULT (0),

    [LAUNCH_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__LAUNC__094028A5] DEFAULT (0),

    [LD_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__LD_DT__0A344CDE] DEFAULT (0),

    [LD_WAVE_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__LD_WA__0B287117] DEFAULT (0),

    [MKT_REGN_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__MKT_R__0C1C9550] DEFAULT (0),

    [MSG_OPEN_TS] [datetime] NULL,

    [PR_EMP_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__PR_EM__0D10B989] DEFAULT (0),

    [SCHEDULE_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__SCHED__0E04DDC2] DEFAULT (0),

    [SOURCE_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_CAMP_HI__SOURC__0EF901FB] DEFAULT (0)

    ) ON [PRIMARY]

    CREATE TABLE [dbo].[W_SRC_OFFR_H](

    [ETL_PROC_WID] [numeric](10, 0) NOT NULL,

    [OFFER_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_SRC_OFF__OFFER__78D4B6B2] DEFAULT (0),

    [SOURCE_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_SRC_OFF__SOURC__79C8DAEB] DEFAULT (0),

    [PR_OFFER_FLG] [nchar](1) NULL

    ) ON [PRIMARY]

    CREATE TABLE [dbo].[W_PARAM_G](

    [LAST_UPD] [datetime] NULL CONSTRAINT [DF__W_PARAM_G__LAST___0E04126B] DEFAULT (getdate()),

    [ALIGNMENT_VER] [nchar](1) NOT NULL CONSTRAINT [DF__W_PARAM_G__ALIGN__0EF836A4] DEFAULT ('N'),

    [DATASOURCE_NUM_ID] [numeric](10, 0) NOT NULL,

    [ETL_PROC_WID] [numeric](10, 0) NOT NULL,

    [INTEGRATION_ID] [nvarchar](30) NOT NULL,

    [LOAD_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_PARAM_G__LOAD___0FEC5ADD] DEFAULT (0),

    [LOAD_WK_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_PARAM_G__LOAD___10E07F16] DEFAULT (0),

    [PRUNE_DT_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_PARAM_G__PRUNE__11D4A34F] DEFAULT (0),

    [PRUNE_WK_WID] [numeric](10, 0) NOT NULL CONSTRAINT [DF__W_PARAM_G__PRUNE__12C8C788] DEFAULT (0),

    [ROW_WID] [numeric](10, 0) NOT NULL,

    [ANALYSIS_END] [datetime] NULL,

    [ANALYSIS_END_WID] [numeric](10, 0) NULL,

    [ANALYSIS_START] [datetime] NULL,

    [ANALYSIS_START_WID] [numeric](10, 0) NULL,

    [COMMIT_SIZE] [numeric](10, 0) NULL,

    [DFLT_EXCH_RATE] [numeric](22, 7) NULL,

    [DURATION] [numeric](10, 0) NULL,

    [FULL_THRSHLD_HRS] [numeric](10, 0) NULL,

    [INC_THRSHLD_HRS] [numeric](10, 0) NULL,

    [JULIAN_RUN_DT] [numeric](22, 7) NULL,

    [LOAD_DT] [datetime] NULL,

    [MAX_DAYS_IN_STG] [numeric](10, 0) NULL,

    [PRUNE_DT] [datetime] NULL,

    [REFRESH_NUM_DAYS] [numeric](10, 0) NULL,

    [RIMG_PRUNE_DAYS] [numeric](10, 0) NULL,

    [START_JUL_NUM] [numeric](10, 0) NULL,

    [BASE_EXCH_CURCY] [nvarchar](100) NULL,

    [DATE_FORMAT] [nvarchar](100) NULL,

    [DFLT_CONTINENT] [nvarchar](100) NULL,

    [DFLT_COUNTRY] [nvarchar](100) NULL,

    [DFLT_CURCY] [nvarchar](100) NULL,

    [DFLT_LANG] [nvarchar](100) NULL,

    [FK_DT_FORMAT] [nvarchar](100) NULL,

    [INDEX_SPACE] [nvarchar](30) NULL,

    [LOV_MAX_VAL] [nvarchar](100) NULL,

    [LOV_MIN_VAL] [nvarchar](100) NULL,

    [MLOV] [nvarchar](100) NULL

    ) ON [PRIMARY]

    Here are some of the rows in each table:

    W_PARAM_G:

    2004-04-07 21:06:15.833,N,1,17031,1,20080610,0,0,0,1,2010-12-31 03:00:00.000,20101231,1980-01-01 03:00:00.000,19800101,0,1.0000000,NULL,0,0,NULL,2008-06-10 10:03:18.007,30,NULL,0,30,2444240,USD,YYYYMMDD,North America,USA,USD,ENU,YYYYMMDD,NULL,9999999999,0,N/A

    W_SRC_OFFR_H:

    14675,2426,4491,

    14675,2428,4492,

    14675,2427,4494,

    9416,2435,4496,Y

    11500,2252,4497,Y

    11500,2431,4497,

    9416,830,4498,

    9416,831,4498,Y

    11500,2430,4499,Y

    11500,2433,4499,

    11500,2430,4500,Y

    11500,2433,4500,

    11500,2430,4501,Y

    11500,2433,4501,

    11500,2430,4502,Y

    11500,2433,4502,

    11500,2430,4503,Y

    11500,2433,4503,

    11500,2430,4504,Y

    11500,2433,4504,

    11500,2429,4505,Y

    11500,2432,4505,

    11500,2429,4506,Y

    11500,2432,4506,

    11500,2429,4507,Y

    11500,2432,4507,

    11500,2429,4508,Y

    11500,2432,4508,

    11500,2429,4509,Y

    11500,2432,4509,

    11500,2429,4510,Y

    11500,2432,4510,

    9416,2434,4511,Y

    9416,772,4512,

    9416,867,4512,Y

    11056,555,4513,Y

    11056,555,4514,Y

    11056,555,4515,Y

    11500,2252,4516,Y

    11500,2431,4516,

    11500,2252,4517,Y

    11500,2431,4517,

    11500,2252,4518,Y

    11500,2431,4518,

    11500,2252,4519,Y

    11500,2431,4519,

    11500,2252,4520,Y

    11500,2431,4520,

    5280,2025,4521,Y

    5280,2420,4521,

    5280,2421,4521,

    11056,555,4522,Y

    11500,2430,4523,Y

    11500,2433,4523,

    11500,2429,4524,Y

    11500,2432,4524,

    11500,2252,4525,Y

    11500,2431,4525,

    9416,2438,2557,

    9416,2330,4496,

    9416,2395,4496,

    9416,2338,4511,

    9416,2357,4511,

    9416,2395,4511,

    9416,2025,4527,Y

    9416,2077,4527,

    9416,2436,4527,

    9416,244,4528,

    9416,245,4528,Y

    9416,2437,4529,Y

    9416,2438,4529,

    13522,2294,4530,

    9416,2330,4530,

    9416,2439,4530,Y

    9416,2040,4531,

    9416,2338,4531,

    9416,2357,4531,

    9416,2440,4531,Y

    14702,2441,4532,

    14702,2442,4532,Y

    14702,2441,4533,

    14702,2442,4533,Y

    14702,2441,4534,

    14702,2442,4534,Y

    14702,2441,4535,

    14702,2442,4535,Y

    14702,2441,4536,

    14702,2442,4536,Y

    15166,2441,4537,

    15166,2442,4537,Y

    9416,2443,4538,Y

    9416,2444,4539,Y

    9416,2395,4540,

    9416,2399,4540,Y

    9416,2229,4541,Y

    9416,2230,4541,

    9416,1784,4542,

    9416,1785,4542,Y

    9416,1149,4543,Y

    9416,1150,4543,

    14702,2441,4544,

    14702,2442,4544,Y

    14702,2441,4545,

    14702,2442,4545,Y

    14702,2441,4546,

    14702,2442,4546,Y

    14702,2442,4547,Y

    14937,2441,4548,

    14937,2442,4548,Y

    14937,2441,4549,

    14937,2442,4549,Y

    14937,2441,4550,

    14937,2442,4550,Y

    14937,2442,4551,Y

    14937,2441,4552,

    14937,2442,4552,Y

    14937,2441,4553,

    14937,2442,4553,Y

    14937,2441,4554,

    14937,2442,4554,Y

    14937,2441,4555,

    14937,2442,4555,Y

    14937,2441,4556,

    14937,2442,4556,Y

    14937,2441,4557,

    14937,2442,4557,Y

    14702,2441,4558,

    14702,2442,4558,Y

    14937,2441,4559,

    14937,2442,4559,Y

    14937,2441,4560,

    14937,2442,4560,Y

    14702,2441,4561,

    14702,2442,4561,Y

    14702,2441,4562,

    14702,2442,4562,Y

    14702,2441,4563,

    14702,2442,4563,Y

    14702,2441,4564,

    14702,2442,4564,Y

    14702,2441,4565,

    14702,2442,4565,Y

    9416,1177,4538,

    W_CAMP_HIST_F

    463243,663,95,0,0,0,0,95694,20050329,1,481,1-2L81RO,11723098,1312,0,0,NULL,N,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,03/29/2005 11:46:46,NULL,NULL,0,0,0,0,0,0,0,0,0,0,NULL,0,0,95

    463244,663,95,0,0,0,0,95695,20050329,1,481,1-2L81RP,11723099,1312,0,0,NULL,N,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,03/29/2005 11:46:46,NULL,NULL,0,0,0,0,0,0,0,0,0,0,NULL,0,0,95

  • You are part way there. Yes, you posted the DDL for the tables. Yes, you posted some data. Unfortunately, the data is not posted in a format that would allow us to cut and paste into SSMS and load the data into your tables. Personally, I don't have time to reformat it into a suitable format here at work as I do have other things to do. Also, you still haven't provided what the expected results from the query should be based on the data provided. This means we have nothing to check against to see if we are even close to helping you resolve the performance issues.

    😎

  • Also, after reviewing your post a second time. We could also use the DDL to recreate your current indexing scheme on the three tables.

    😎

  • On your prior thread, I can't get to page 2 of it (times out), so I can't tell if you looked at the query I wrote and tried it out. Did you? (Final query on page 1 of your other thread.)

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • GSquared,

    Was that the query you took out a join? If so, I seem to remember he did and that it didn't return the results he was expecting. If I also remember correctly, he said he needed that join to filter the data.

    pino_daddy,

    Did I remember all this correctly?

    😎

  • That would make sense.

    Was the query tried with that join added back in but the rest the way I wrote it?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • That I can't answer, and it looks like to previous thread is still unavailable.

    😎

  • GSquared,

    As you can probably tell, I am not a SQL expert, not a SQL intermediate, not even a SQL novice.

    If you could provice that query again the way you wrote it with the ETL_PROC_WID join I would really appreciate it.

    As for DLL for table data to load up the table, sorry, but yor are talking Chinese to a guy that only understands English.

    The table has 16indexes on it, which I will probably find out later are all useless. A nice addition to SQL Server 2005 for us people that don't have a clue.

    Thanks again everyone

  • GSquared,

    my e-mail is pino_daddy@yahoo.com. If there are more things you would like me to provide to you, just let me know. I know you said to use the query you gave me and add the join back in and try it, but I can't get to that posting.

    If you would care to take another try at it, I certainly would appreciate it.

    Thanks again

  • SELECT

    CHF.CONTACT_WID , COUNT(DISTINCT CHF.SOURCE_WID) , COUNT(DISTINCT isnull(POH.OFFER_WID, 0)) - SUM (CASE WHEN (POH.OFFER_WID = 0 OR POH.OFFER_WID IS NULL) THEN 1 ELSE 0 END)

    FROM

    W_CAMP_HIST_F CHF LEFT OUTER JOIN W_SRC_OFFR_H POH ON CHF.SOURCE_WID = POH.SOURCE_WID ,

    W_PARAM_G PARAM

    WHERE

    CHF.CONTACT_WID > 0 AND CHF.SOURCE_WID> 0 AND (CHF.ETL_PROC_WID = PARAM.ETL_PROC_WID OR POH.ETL_PROC_WID = PARAM.ETL_PROC_WID) GROUP BY CONTACT_WID

    Results are:

    51635810

    12325210

    175413410

    11849710

    115907310

    13014310

    184004410

    183597610

    69610610

    55588010

    5453810

    Query takes 59 minutes to execute

    Client Statistics are:

    Client Execution Time19:33:06

    Query Profile Statistics

    Number of INSERT, DELETE and UPDATE statements00.0000

    Rows affected by INSERT, DELETE, or UPDATE statements00.0000

    Number of SELECT statements 22.0000

    Rows returned by SELECT statements237837237837.0000

    Number of transactions 00.0000

    Network Statistics

    Number of server roundtrips33.0000

    TDS packets sent from client33.0000

    TDS packets received from server10101010.0000

    Bytes sent from client12481248.0000

    Bytes received from server41273194127319.0000

    Time Statistics

    Client processing time406406.0000

    Total execution time30612143061214.0000

    Wait time on server replies30608083060808.0000

    If I knew how to attach a file I would include the execution plan

  • Is this post considered dead now? When I first opened it I got all kinds of responses. Now after 2 days not even a hello. LOL

  • No. It means we have been doing our own work, or helping others whose problems/issues/questions were easily answered. I need additional time to look at your issue which I don't have here at work.

    When I am at home, I should hopefully be able to spend some additional time looking into your issue.

    😎

  • Thank you very much.

    I appreciate the response. I wish I had a copy of Quest Software, it seesm to help out sometimes by rewriting the query and trying it out. But my temporary subscription has expired.

    This is one query I would really like to see run in 30 minutes or less. I just ran out of ideas and hit a brick wall.

  • pino -

    below the main reply area - there's a "post options" section. In there is a button called "edit attachments". Click that to add files.

    Most folks tend to prefer the xml version of the exec plan if you can provide it.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Also - DDL = data definition language. Lynn was asking you to include the index definitions in the "create table scripts" (that's one of those options you can set under tools options, scripting). The indexes and the exec plan are key to giving you pointers.

    Since you're new - I decided to format your test data. Although it was good of you to include it - formatting it so that it can simply be run will greatly increase your likelihood of getting someone to answer.

    Here's the test data, reformatted to help us help you:

    INSERT INTO [test].[dbo].[W_PARAM_G]

    ([LAST_UPD]

    ,[ALIGNMENT_VER]

    ,[DATASOURCE_NUM_ID]

    ,[ETL_PROC_WID]

    ,[INTEGRATION_ID]

    ,[LOAD_DT_WID]

    ,[LOAD_WK_WID]

    ,[PRUNE_DT_WID]

    ,[PRUNE_WK_WID]

    ,[ROW_WID]

    ,[ANALYSIS_END]

    ,[ANALYSIS_END_WID]

    ,[ANALYSIS_START]

    ,[ANALYSIS_START_WID]

    ,[COMMIT_SIZE]

    ,[DFLT_EXCH_RATE]

    ,[DURATION]

    ,[FULL_THRSHLD_HRS]

    ,[INC_THRSHLD_HRS]

    ,[JULIAN_RUN_DT]

    ,[LOAD_DT]

    ,[MAX_DAYS_IN_STG]

    ,[PRUNE_DT]

    ,[REFRESH_NUM_DAYS]

    ,[RIMG_PRUNE_DAYS]

    ,[START_JUL_NUM]

    ,[BASE_EXCH_CURCY]

    ,[DATE_FORMAT]

    ,[DFLT_CONTINENT]

    ,[DFLT_COUNTRY]

    ,[DFLT_CURCY]

    ,[DFLT_LANG]

    ,[FK_DT_FORMAT]

    ,[INDEX_SPACE]

    ,[LOV_MAX_VAL]

    ,[LOV_MIN_VAL]

    ,[MLOV])

    select '2004-04-07 21:06:15.833',

    'N',

    1,

    17031,

    1,

    20080610,

    0,0,0,1,

    '2010-12-31 03:00:00.000',

    '20101231',

    '1980-01-01 03:00:00.000',

    '19800101',

    0,1.0000000,NULL,0,0,NULL,

    '2008-06-10 10:03:18.007',

    30,NULL,0,30,2444240,

    'USD','YYYYMMDD','North America',

    'USA','USD','ENU','YYYYMMDD',

    NULL,9999999999,0,'N'

    INSERT INTO [test].[dbo].[W_SRC_OFFR_H]

    ([ETL_PROC_WID]

    ,[OFFER_WID]

    ,[SOURCE_WID]

    ,[PR_OFFER_FLG])

    select 14675,2426,4491, null

    union all select 14675,2428,4492, null

    union all select 14675,2427,4494, null

    union all select 9416,2435,4496,'Y'

    union all select 11500,2252,4497,'Y'

    union all select 11500,2431,4497, null

    union all select 9416,830,4498, null

    union all select 9416,831,4498,'Y'

    union all select 11500,2430,4499,'Y'

    union all select 11500,2433,4499, null

    union all select 11500,2430,4500,'Y'

    union all select 11500,2433,4500, null

    union all select 11500,2430,4501,'Y'

    union all select 11500,2433,4501, null

    union all select 11500,2430,4502,'Y'

    union all select 11500,2433,4502, null

    union all select 11500,2430,4503,'Y'

    union all select 11500,2433,4503, null

    union all select 11500,2430,4504,'Y'

    union all select 11500,2433,4504, null

    union all select 11500,2429,4505,'Y'

    union all select 11500,2432,4505, null

    union all select 11500,2429,4506,'Y'

    union all select 11500,2432,4506, null

    union all select 11500,2429,4507,'Y'

    union all select 11500,2432,4507, null

    union all select 11500,2429,4508,'Y'

    union all select 11500,2432,4508, null

    union all select 11500,2429,4509,'Y'

    union all select 11500,2432,4509, null

    union all select 11500,2429,4510,'Y'

    union all select 11500,2432,4510, null

    union all select 9416,2434,4511,'Y'

    union all select 9416,772,4512, null

    union all select 9416,867,4512,'Y'

    union all select 11056,555,4513,'Y'

    union all select 11056,555,4514,'Y'

    union all select 11056,555,4515,'Y'

    union all select 11500,2252,4516,'Y'

    union all select 11500,2431,4516, null

    union all select 11500,2252,4517,'Y'

    union all select 11500,2431,4517, null

    union all select 11500,2252,4518,'Y'

    union all select 11500,2431,4518, null

    union all select 11500,2252,4519,'Y'

    union all select 11500,2431,4519, null

    union all select 11500,2252,4520,'Y'

    union all select 11500,2431,4520, null

    union all select 5280,2025,4521,'Y'

    union all select 5280,2420,4521, null

    union all select 5280,2421,4521, null

    union all select 11056,555,4522,'Y'

    union all select 11500,2430,4523,'Y'

    union all select 11500,2433,4523, null

    union all select 11500,2429,4524,'Y'

    union all select 11500,2432,4524, null

    union all select 11500,2252,4525,'Y'

    union all select 11500,2431,4525, null

    union all select 9416,2438,2557, null

    union all select 9416,2330,4496, null

    union all select 9416,2395,4496, null

    union all select 9416,2338,4511, null

    union all select 9416,2357,4511, null

    union all select 9416,2395,4511, null

    union all select 9416,2025,4527,'Y'

    union all select 9416,2077,4527, null

    union all select 9416,2436,4527, null

    union all select 9416,244,4528, null

    union all select 9416,245,4528,'Y'

    union all select 9416,2437,4529,'Y'

    union all select 9416,2438,4529, null

    union all select 13522,2294,4530, null

    union all select 9416,2330,4530, null

    union all select 9416,2439,4530,'Y'

    union all select 9416,2040,4531, null

    union all select 9416,2338,4531, null

    union all select 9416,2357,4531, null

    union all select 9416,2440,4531,'Y'

    union all select 14702,2441,4532, null

    union all select 14702,2442,4532,'Y'

    union all select 14702,2441,4533, null

    union all select 14702,2442,4533,'Y'

    union all select 14702,2441,4534, null

    union all select 14702,2442,4534,'Y'

    union all select 14702,2441,4535, null

    union all select 14702,2442,4535,'Y'

    union all select 14702,2441,4536, null

    union all select 14702,2442,4536,'Y'

    union all select 15166,2441,4537, null

    union all select 15166,2442,4537,'Y'

    union all select 9416,2443,4538,'Y'

    union all select 9416,2444,4539,'Y'

    union all select 9416,2395,4540, null

    union all select 9416,2399,4540,'Y'

    union all select 9416,2229,4541,'Y'

    union all select 9416,2230,4541, null

    union all select 9416,1784,4542, null

    union all select 9416,1785,4542,'Y'

    union all select 9416,1149,4543,'Y'

    union all select 9416,1150,4543, null

    union all select 14702,2441,4544, null

    union all select 14702,2442,4544,'Y'

    union all select 14702,2441,4545, null

    union all select 14702,2442,4545,'Y'

    union all select 14702,2441,4546, null

    union all select 14702,2442,4546,'Y'

    union all select 14702,2442,4547,'Y'

    union all select 14937,2441,4548, null

    union all select 14937,2442,4548,'Y'

    union all select 14937,2441,4549, null

    union all select 14937,2442,4549,'Y'

    union all select 14937,2441,4550, null

    union all select 14937,2442,4550,'Y'

    union all select 14937,2442,4551,'Y'

    union all select 14937,2441,4552, null

    union all select 14937,2442,4552,'Y'

    union all select 14937,2441,4553, null

    union all select 14937,2442,4553,'Y'

    union all select 14937,2441,4554, null

    union all select 14937,2442,4554,'Y'

    union all select 14937,2441,4555, null

    union all select 14937,2442,4555,'Y'

    union all select 14937,2441,4556, null

    union all select 14937,2442,4556,'Y'

    union all select 14937,2441,4557, null

    union all select 14937,2442,4557,'Y'

    union all select 14702,2441,4558, null

    union all select 14702,2442,4558,'Y'

    union all select 14937,2441,4559, null

    union all select 14937,2442,4559,'Y'

    union all select 14937,2441,4560, null

    union all select 14937,2442,4560,'Y'

    union all select 14702,2441,4561, null

    union all select 14702,2442,4561,'Y'

    union all select 14702,2441,4562, null

    union all select 14702,2442,4562,'Y'

    union all select 14702,2441,4563, null

    union all select 14702,2442,4563,'Y'

    union all select 14702,2441,4564, null

    union all select 14702,2442,4564,'Y'

    union all select 14702,2441,4565, null

    union all select 14702,2442,4565,'Y'

    union all select 9416,1177,4538, null

    INSERT INTO [test].[dbo].[W_CAMP_HIST_F]

    ([ACCNT_WID]

    ,[CALL_STATUS_WID]

    ,[CAMPAIGN_WID]

    ,[CAMP_OWNER_ORG_WID]

    ,[CAMP_PARTNER_WID]

    ,[COMPLETED_DT_WID]

    ,[CONTACTED_DT_WID]

    ,[CONTACT_WID]

    ,[CREATED_DT_WID]

    ,[DATASOURCE_NUM_ID]

    ,[ETL_PROC_WID]

    ,[INTEGRATION_ID]

    ,[ROW_WID]

    ,[SEGMENT_WID]

    ,[VENDOR_WID]

    ,[WAVE_WID]

    ,[COMPLETED_DT]

    ,[CONTACTED_FLG]

    ,[NUM_ATTEMPTS]

    ,[NUM_DAYS_TOCONTACT]

    ,[KEY01]

    ,[KEY02]

    ,[KEY03]

    ,[KEY04]

    ,[KEY05]

    ,[KEY06]

    ,[KEY07]

    ,[SOURCE_CODE]

    ,[X_MSG_BNCD_STAT_CD]

    ,[X_MSG_OPEN_TS]

    ,[BNCE_REASON_WID]

    ,[BNCE_TYPE_WID]

    ,[CAMP_END_DT_WID]

    ,[CAMP_LNCH_DT_WID]

    ,[CAMP_ST_DT_WID]

    ,[CON_OUTCOME_WID]

    ,[LAUNCH_DT_WID]

    ,[LD_DT_WID]

    ,[LD_WAVE_WID]

    ,[MKT_REGN_WID]

    ,[MSG_OPEN_TS]

    ,[PR_EMP_WID]

    ,[SCHEDULE_DT_WID]

    ,[SOURCE_WID])

    SELECT 463243,663,95,0,0,0,0,95694,20050329,1,481,

    '1-2L81RO','11723098',1312,0,0,NULL,'N',0,NULL,NULL,NULL,

    NULL,NULL,NULL,NULL,NULL,'03/29/2005 11:46:46',NULL,

    NULL,0,0,0,0,0,0,0,0,0,0,NULL,0,0,95

    union all

    select 463244,663,95,0,0,0,0,95695,20050329,1,481,

    '1-2L81RP','11723099',1312,0,0,NULL,'N',0,NULL,NULL,

    NULL,NULL,NULL,NULL,NULL,NULL,'03/29/2005 11:46:46',

    NULL,NULL,0,0,0,0,0,0,0,0,0,0,NULL,0,0,95

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

Viewing 15 posts - 1 through 15 (of 46 total)

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