Forum Replies Created

Viewing 15 posts - 12,151 through 12,165 (of 15,381 total)

  • RE: Please convert cursor based query to a set based query

    Taking a shot in the dark...

    select

    num_of_comms = isnull(count(distinct ccl.commsid),0),

    percent_confirmed = case

    when isnull((count(DISTINCT c.subject + Convert(varchar(4),u.userid))),0) = 0 then '0%'

    else (cast(convert(numeric(10,0),((cast(count(distinct cr.id) as money)*100) / cast(count(DISTINCT c.subject + Convert(varchar(4),u.userid))...

  • RE: Orthogonal hierarchies

    This sounds like the adjacency list model would be well suited. It is not the perfect solution but it does sound like it might work in your situation. This is...

  • RE: Please convert cursor based query to a set based query

    Aside from the subselect this is pretty straight forward. Just change this into a single select statement. I can't quite wrap my head around the whole thing. You need to...

  • RE: MAX()

    anthony.green (5/1/2012)


    couple of ways

    SELECT TOP 1 MAX(dbo.BookedFinance.GrossProfit) AS GP,

    dbo.BookedFinance.FinanceID

    FROM dbo.BookedExtrasList INNER JOIN

    ...

  • RE: varchar desc order

    That looks like you are using that column to hold two pieces of information (rack and BinNumber). It would make things a lot easier if you could separate those.

    If...

  • RE: Using a "RunID" to push data to prod DW but not enable for reporting until later?

    You should have a "staging" environment. This is exactly what this is for. You have Dev, QA, Staging, Prod. I would advise strongly against making your production environment for anything...

  • RE: find different rows in tables

    Did the fast_forward make it better? Given the amount of data you might consider putting this in an SSIS package that can handle looping a lot better than t-sql.

  • RE: find different rows in tables

    hehe no worries. 😛

    Now if I take your ddl and sample data. Then run my code it works just fine.

    CREATE TABLE [dbo].[flightsClosed](

    [recid] [int] IDENTITY(1,1) NOT NULL,

    [FlightID] [int] NULL,

    [StatusTypeID] [int] NOT...

  • RE: find different rows in tables

    wmaa (4/30/2012)


    quotes

    That was a problem but the counts are still off.

    Msg 110, Level 15, State 1, Line 2

    There are fewer columns in the INSERT statement than values specified in the...

  • RE: find different rows in tables

    Something is not quite right with those.

    Msg 110, Level 15, State 1, Line 1

    There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number...

  • RE: find different rows in tables

    wmaa (4/30/2012)


    true

    recidFlightIDStatusTypeIDAircraftIDFlightTimeBlockTimeTTEngine1TCEngine1TTEngine2TCEngine2RegistrationTTAirframeTCairframerecidFlightIDStatusTypeIDAircraftIDFlightTimeBlockTimeTTEngine1TCEngine1TTEngine2TCEngine2RegistrationTTAirframeTCairframe

    118181012520154442.302.502884.802321.002702.102040.00N106SL8849.006351.0070882512520153742.302.402884.802321.002702.102040.00N106SL8846.706350.00

    118194712530314440.600.902884.202320.002701.502039.00N106SL8849.006351.0070896212530311440.600.902884.202320.002701.502039.00N106SL8846.706350.00

    Any chance you can turn that into insert statements for me?

  • RE: find different rows in tables

    I guess that demonstrates that the cursor is working. Short of you posting ddl and sample data there is really nothing else I can do to help.

  • RE: find different rows in tables

    wmaa (4/30/2012)


    why not do if the rows exists then copy to temp table then send email for all rows in temp table and exit when done? that was my...

  • RE: find different rows in tables

    I should have also included that you need to

    close FlightClosedList

    deallocate FlightClosedList

  • RE: find different rows in tables

    OK how about the actual query then all by itself?

    SELECT a.flightId,a.FlightTime,a.BlockTime,a.TTEngine1,a.TCEngine1,a.TTEngine2,a.TCEngine2,a.TTAirframe,a.TCAirframe

    FROM flightsClosed as a

    left JOIN flightsClosed2 b

    ON a.FlightID = b.FlightID

    WHERE a.StatusTypeID != b.StatusTypeID

    AND a.StatusTypeID = 44

Viewing 15 posts - 12,151 through 12,165 (of 15,381 total)