Viewing 15 posts - 12,151 through 12,165 (of 15,381 total)
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))...
May 1, 2012 at 9:37 am
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...
May 1, 2012 at 9:05 am
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...
May 1, 2012 at 8:58 am
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...
May 1, 2012 at 8:23 am
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...
May 1, 2012 at 7:43 am
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.
May 1, 2012 at 6:58 am
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...
April 30, 2012 at 2:42 pm
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...
April 30, 2012 at 2:34 pm
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...
April 30, 2012 at 2:24 pm
wmaa (4/30/2012)
truerecidFlightIDStatusTypeIDAircraftIDFlightTimeBlockTimeTTEngine1TCEngine1TTEngine2TCEngine2RegistrationTTAirframeTCairframerecidFlightIDStatusTypeIDAircraftIDFlightTimeBlockTimeTTEngine1TCEngine1TTEngine2TCEngine2RegistrationTTAirframeTCairframe
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?
April 30, 2012 at 1:57 pm
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.
April 30, 2012 at 1:53 pm
wmaa (4/30/2012)
April 30, 2012 at 1:43 pm
I should have also included that you need to
close FlightClosedList
deallocate FlightClosedList
April 30, 2012 at 1:38 pm
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
April 30, 2012 at 1:36 pm
Viewing 15 posts - 12,151 through 12,165 (of 15,381 total)