Forum Replies Created

Viewing 15 posts - 121 through 135 (of 321 total)

  • RE: Hate cursors? Are you a genius query optimizer?

    declare @t table

    (Location int,

    Item int,

    SalesWeek int,

    Qty int)

    insert into @t

    select 1,1,1,1 union all

    select 1,1,2,6 union all

    select 1,1,3,5 union all

    select 1,1,4,2 union all

    select 1,1,5,7 union all

    select 2,1,1,4 union all

    select 2,1,2,1 union...

  • RE: Hate cursors? Are you a genius query optimizer?

    Is this a catch or a bad request ???

    "PK is location, item, salesweek.

    Tables contains records for many locations for many weeks for many items.  I need to remove the

  • RE: Need Help by Update Table !

    delete svtcs

    where code in ('Pause','Pause1','Pause2','Shift','Lunch')

    delete svtcs

    where code in ('CS','OE','Home') and Groupid = 20

    --can be

    delete svtcs

    where code in ('Pause','Pause1','Pause2','Shift','Lunch')

    or (code in ('CS','OE','Home') and Groupid = 20)

     

    --7.identify the Personalnumber

    update svavaya

    set personalnummer =...

  • RE: Need Help by Update Table !

    --the second part

    update svlisteks

    set sollstart=a.sollstart,sollstop=a.sollstop, DEP=a.DEP

    from

    (

    select sv.* from

    svliste sv left outer join svlisteks svks

    on svks.agent = sv.agent  --same agent

    and svks.datum=sv.datum --same datum

    and ISNULL(sv.sollstart,'')=ISNULL(svks.sollstart,'')

    and ISNULL(sv.sollstop,'')=ISNULL(svks.sollstop,'')

    and ISNULL(sv.DEP,'')=ISNULL(svks.DEP,'')

    where svks.agent IS...

  • RE: Need Help by Update Table !

    insert into svlisteks

    select sv.* from

    svliste sv left outer join svlisteks svks on

    svks.agent=sv.agent

    and

    sv.datum=svks.Datum -- a record in svliste has a diff Datum than ANY in svlisteks for a certain agent

    where

    svks.agent...

  • RE: Need Help by Update Table !

    --if you want to ADD the changes

    insert into svlisteks

    select sv.* from

    svliste sv left outer join svlisteks svks

    on svks.agent = sv.agent  --same agent

    and svks.datum=sv.datum and --same datum

    sv.sollstart=svks.sollstart and sv.sollstop=svks.sollstop and sv.DEP=svks.DEP where sv.agent IS...

  • RE: Need Help by Update Table !

    --first part INSERT missing records in svlisteks

    insert into svlisteks

    select sv.* from

    svliste sv left outer join svlisteks svks on

    svks.agent=sv.agent

    where

    sv.datum<>svks.Datum -- a record in svliste has a diff Datum than...

  • RE: Need Help by Update Table !

    Still didn't respond to what means a change!

    For example :

    - INSERT when into svlisteks from svliste when the agent's record is NOT in svlisteks but EXISTS in svliste

    -INSERT into svlisteks...

  • RE: Need Help by Update Table !

    "I only want the changes update."

     

    What do you consider change?

    ONLY the new records in svliste?

  • RE: Using calculated values within the same Select Statement

    SELECT

    PriceDate,

    PortName,

    'Amount1' = SUM(CASE WHEN TransCatCode='005'THEN BaseSettleAmt ELSE 0 END),

    'Amount2' = SUM(CASE WHEN TransCatCode='010'THEN BaseSettleAmt ELSE 0 END),

    'Par'=SUM(CASE WHEN TransCatCode='005'THEN BaseSettleAmt WHEN TransCatCode='010' THEN -BaseSettleAmt ELSE 0 END)/1000

    FROM Table1

    WHERE SUBSTRING(PortName, 1,...

  • RE: Need Help by Update Table !

    Can't figure out what you need : ((  The second part retrieves the first record that you posted...

     

    select sv.* from

    svliste sv left outer join svlisteks svks on

    svks.agent=sv.agent

    where svks.agent is...

  • RE: Need Help by Update Table !

    Thomas because your only problem is that update just put here the DDL for svlisteks, svliste and some sample (5-10 rows) date in each one and the result that you...

  • RE: Please help in this trigger!!!

    CREATE TRIGGER IDU_tblmembers

    ON tblmembers

    FOR INSERT, UPDATE, DELETE

    AS

    INSERT INTO TX_tblmembers

    Select ID, fname, lname, address,newid(),'d',getdate(),0 from deleted

    INSERT INTO TX_tblmembers

    Select ID, fname, lname, address,newid(),'i',getdate(),0 from inserted

  • RE: Please help in this trigger!!!

    None beside copy-paste  : ) 

Viewing 15 posts - 121 through 135 (of 321 total)