Forum Replies Created

Viewing 15 posts - 151 through 165 (of 244 total)

  • RE: hourly average

    --oops i forgot to put the hours in there...the below should do it

    create table #temp

    (

    id int

    , utctd datetime

    , produced int

    )

    insert into #temp

    select 1, '2009-01-28 06:09:34.563', 140 union all

    select 1...

  • RE: hourly average

    i probably should have used a cte just to get into the habit.

  • RE: hourly average

    --create table #temp

    --(

    --id int

    --, utctd datetime

    --, produced int

    --)

    --insert into #temp

    --select 1, '2009-01-28 06:09:34.563', 140 union all

    --select 1 ,'2009-01-28 06:49:11.261', 150 union all

    --select 1 ,'2009-01-28 06:56:21.123', 160 union all

    --select 1...

  • RE: Temp Table and Real Table Usage Patern Question

    so when he's running

    select * into pqchildren from #pqchildren

    then whatever db you are in you will see a new table called pqchildren

    the below will obviously drop the newly...

  • RE: Temp Table and Real Table Usage Patern Question

    the only reason i can think he would have done that is because when he does the "into" statment he is actually creating a real table w/ that name and...

  • RE: UPDATE query taking more time ...

    it may also be that there are no indexes in prod or dev. just that dev has tons less data than prod.

  • RE: Baffling TSQL statement

    create table #distCats

    (

    CurrentCategoryArea varchar(200)

    )

    insert into #distCats

    select distinct CurrentCategoryArea

    from CurrentCompetitorCategoryArea

    --then later in your join rather than having

    INNER JOIN dbo.CurrentCompetitorCategoryArea CA

    ON MT.categoryArea = CA.CurrentCategoryArea

    --change it to

    INNER JOIN...

  • RE: COALESCE Problem

    --this version has unique pc+profile_id's

    drop table #savingstemp

    --===== Create the test table with

    CREATE TABLE #savingstemp

    (

    pc_profile_id int,

    shutdown_Time datetime NULL,

    hibernate_Time datetime NULL,

    sleep_Time datetime NULL,

    startup_Time datetime NULL,

    status varchar(50),

    subpolicy_name varchar(50),

    building_name varchar(50),

    hours_off_day int,

    day_hour_rate float,

    hours_off_night int,

    night_hour_rate float,

    pc_kwh_rate...

  • RE: COALESCE Problem

    now i know this may sound stupid but i'm trying to figure out what your saying your problem is. if you saying you that both result set should return the...

  • RE: COALESCE Problem

    when u say crazy results can you explain. Are you saying the two chunks of sql should return the same result set?

  • RE: COALESCE Problem

    --here is ur code w/o the two errors mentioned above

    drop table #savingstemp

    --===== Create the test table with

    CREATE TABLE #savingstemp

    (

    pc_profile_id int,

    shutdown_Time datetime NULL,

    hibernate_Time datetime NULL,

    sleep_Time datetime NULL,

    startup_Time datetime NULL,

    status varchar(50),

    subpolicy_name varchar(50),

    building_name...

  • RE: COALESCE Problem

    insert #savingstemp (pc_profile_id, shutdown_Time, startup_Time, status, subpolicy_name, building_name, day_hour_rate, night_hour_rate, pc_kwh_rate)

    SELECT '2', '02/01/2009 11:02:08', '02/01/2009 16:03:03', 'CLOSED', 'Exempt', 'ORB', '1.2','3.9', '1.9' UNION ALL

    SELECT '3', '04/09/2009 11:00:17', '04/09/2009 16:03:00', 'CLOSED', 'Exempt',...

  • RE: COALESCE Problem

    i cant get it to run w/o erroring. i've made a few changes and gave up

  • RE: Date Calculation

    It demonstrates that you are commited to solving your problem.

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

    It also gives us all level ground to work from. When you don't provide this sort of info i think we...

  • RE: Date Calculation

    select DateDIFF(dd,'09/09/2009' ,'09/10/2007')

Viewing 15 posts - 151 through 165 (of 244 total)