Performance Issue ---Need help

Hello Friends,
Could you guys please help me in improving the performance. This query takes 2 minutes to run and I was wondering if you guys can just take a look and suggest something. I would really appreciate your help on this
ALTER PROCEDURE [dbo].test
@loginid int,
@branchid int,
@asofdate datetime,
@ageperiod int,
@showdetails bit,
@programstatus INT,
@propertytype INT,
@sortby nvarchar(100)
AS
BEGIN
SET FMTONLY OFF -- will allow temp tables on procedures for fyi reporting
SET NOCOUNT ON
SELECT
mecdate = CONVERT( DATETIME, CONVERT(NVARCHAR(4),monthendyear) + '-' + CONVERT(NVARCHAR(2),monthendmonth) + '-1 00:00:00.000' ),
branchid
INTO
#mecs
FROM
tmonthendcompleted
WHERE
companyid = 1 -- we should put it as parameter but we only have one company
AND
@branchid = -999
OR branchid = @branchid
--Create temp table
CREATE TABLE #tmpAR
branchid int not null default (0),
accountid int not null default (0),
siteid int not null default (0),
programid int not null default (0),
routeid int not null default(0),
invoiceid int not null default (0),
paymentid int not null default(0),
transactiondate datetime not null,
eventname nvarchar(50) not null,
agingbucketnumber int not null default (0),
invoicetotal money not null default (0),
paymenttotal money not null default (0),
prepay money not null default (0),
prepayid int not null default(0)
--Get pending invoices
INSERT INTO
#tmpAR (branchid, accountid, siteid, programid, routeid, invoiceid, transactiondate, eventname, agingbucketnumber, invoicetotal)
SELECT
invitem.servicecenterid, inv.accountid, est.siteid, invitem.programid,
ISNULL((select top 1 routeid from tprogramvalue WHERE programid = invitem.programid AND effectivedate <= @asofdate and routeid > 0 order by effectivedate desc, utctimestamp desc), 0),
inv.invoiceid, inv.invoicedate, max(invitem.itemdescription),
-- go to first day of invoice month, get max MEC date and datediff to get bucket # (according to asofdate)
ISNULL((DATEDIFF(MONTH, DATEADD(month, DATEDIFF(month, 0, inv.invoicedate), 0), (SELECT MAX(mecdate) FROM #mecs WHERE branchid = invitem.servicecenterid AND mecdate <= @asofdate)) ),0),
SUM(invitem.subtotalregular + invitem.fedtaxregular + invitem.statetaxregular + invitem.localtaxregular)
FROM
tinvoiceitem invitem
INNER JOIN tinvoice inv ON invitem.invoiceid = inv.invoiceid
INNER JOIN tprogram prog ON invitem.programid = prog.programid
INNER JOIN tprogramsetup ON prog.programtypeid = tprogramsetup.programtypeid
INNER JOIN testimate est ON prog.estimateid = est.estimateid
INNER JOIN vreportlogin on invitem.servicecenterid = vreportlogin.branchid
INNER JOIN ttempkeyid tmpkey on tprogramsetup.reportcategory=tmpkey.keyid and tmpkey.typeid=64 and tmpkey.loginid = @loginid
WHERE
vreportlogin.loginid = @loginid
AND (@branchid=-999 or vreportlogin.branchid = @branchid)
AND inv.invoicedate < @asofdate
GROUP BY
invitem.servicecenterid, inv.accountid, est.siteid, invitem.programid, inv.routeid,
inv.invoiceid, inv.invoicedate
HAVING
(ROUND(SUM(ISNULL([subtotalregular],0) + ISNULL([fedtaxregular],0) + ISNULL([statetaxregular],0) + ISNULL([localtaxregular],0)),2)
ROUND(ISNULL((select sum(tpaymentitem.amount)
from tpaymentitem
inner join tpayment on tpayment.paymentid = tpaymentitem.headerid
where invoiceid=inv.invoiceid
and tpayment.datereceived < @asofdate),0)
,2)
) > 0
--Get payments to pending invoices
INSERT INTO
#tmpAR (branchid, accountid, siteid, programid, routeid, invoiceid, paymentid, transactiondate, eventname, agingbucketnumber, paymenttotal)
SELECT
payitem.servicecenterid, pay.accountid, est.siteid, payitem.programid,
ISNULL((select top 1 routeid from tprogramvalue WHERE programid =payitem.programid AND effectivedate <= @asofdate and routeid > 0 order by effectivedate desc, utctimestamp desc), 0),
payitem.invoiceid, pay.paymentid, pay.datereceived,
(select max(tinvoiceitem.itemdescription) from tinvoiceitem where invoiceid = payitem.invoiceid),
-- go to first day of invoice month, get max MEC date and datediff to get bucket # (according to asofdate)
ISNULL((DATEDIFF(MONTH, DATEADD(month, DATEDIFF(month, 0, inv.invoicedate), 0), (SELECT MAX(mecdate) FROM #mecs WHERE branchid = payitem.servicecenterid AND mecdate <= @asofdate)) ),0),
SUM(payitem.amount)
FROM
tpaymentitem payitem
INNER JOIN tpayment pay ON payitem.headerid = pay.paymentid
INNER JOIN tprogram prog ON payitem.programid = prog.programid
INNER JOIN tprogramsetup ON prog.programtypeid = tprogramsetup.programtypeid
INNER JOIN testimate est ON prog.estimateid = est.estimateid
INNER JOIN tinvoice inv ON payitem.invoiceid = inv.invoiceid
INNER JOIN vreportlogin on payitem.servicecenterid = vreportlogin.branchid
INNER JOIN ttempkeyid tmpkey on tprogramsetup.reportcategory=tmpkey.keyid and tmpkey.typeid=64 and tmpkey.loginid = @loginid
WHERE
vreportlogin.loginid = @loginid
AND (@branchid=-999 or vreportlogin.branchid = @branchid)
AND payitem.invoiceid in (select invoiceid from #tmpAR)
AND pay.datereceived < @asofdate
GROUP BY
payitem.servicecenterid, pay.accountid, est.siteid, payitem.programid, inv.routeid,
payitem.invoiceid, inv.invoicedate, pay.paymentid, pay.datereceived
--Get payments to cop
INSERT INTO
#tmpAR (branchid, accountid, siteid, programid, routeid, prepayid, transactiondate, eventname, prepay)
SELECT
payitem.servicecenterid, pay.accountid, est.siteid, payitem.programid,
ISNULL((select top 1 routeid from tprogramvalue WHERE programid =payitem.programid AND effectivedate <= @asofdate and routeid > 0 order by effectivedate desc, utctimestamp desc), 0) as routeid,
pay.paymentid, pay.datereceived, max(progname.programname), SUM(payitem.amount)
FROM
tpaymentitem payitem
INNER JOIN tpayment pay ON payitem.headerid = pay.paymentid
INNER JOIN tprogram prog ON payitem.programid = prog.programid
INNER JOIN tprogramsetup ON prog.programtypeid = tprogramsetup.programtypeid
INNER JOIN tprogramsetupname000 progname ON progname.programtypeid = prog.programtypeid
INNER JOIN testimate est ON prog.estimateid = est.estimateid
INNER JOIN vreportlogin on payitem.servicecenterid = vreportlogin.branchid
INNER JOIN ttempkeyid tmpkey on tprogramsetup.reportcategory=tmpkey.keyid and tmpkey.typeid=64 and tmpkey.loginid = @loginid
WHERE
vreportlogin.loginid = @loginid
AND (@branchid=-999 or vreportlogin.branchid = @branchid)
AND pay.datereceived < @asofdate
AND payitem.invoiceid = 0
GROUP BY
pay.paymentid, payitem.servicecenterid, pay.accountid, est.siteid, payitem.programid, pay.datereceived
CREATE TABLE #tmpAR2
branchid int not null default (0),
accountid int not null default (0),
siteid int not null default(0),
programid int not null default(0),
routeid int not null default(0),
invoiceid int not null default(0),
paymentid int not null default(0),
prepayid int not null default(0),
transactiondate datetime,
transactiondescription nvarchar(200),
eventname nvarchar(50),
InBucket01 money default (0),
InBucket2 money default (0),
InBucket3 money default (0),
InBucket4 money default (0),
InBucket5 money default (0),
prepay money default (0),
ProgramInBucket01 money not null default(0),
ProgramInBucket2 money not null default(0),
ProgramInBucket3 money not null default(0),
ProgramInBucket4 money not null default(0),
ProgramInBucket5 money not null default(0),
ProgramDebit money not null default(0),
ProgramCredit money not null default(0),
ProgramBalance money not null default(0),
RouteInBucket01 money not null default(0),
RouteInBucket2 money not null default(0),
RouteInBucket3 money not null default(0),
RouteInBucket4 money not null default(0),
RouteInBucket5 money not null default(0),
RouteDebit money not null default(0),
RouteCredit money not null default(0),
RouteBalance money not null default(0),
BranchInBucket01 money not null default(0),
BranchInBucket2 money not null default(0),
BranchInBucket3 money not null default(0),
BranchInBucket4 money not null default(0),
BranchInBucket5 money not null default(0),
BranchDebit money not null default(0),
BranchCredit money not null default(0),
BranchBalance money not null default(0)
update #tmpAR
set agingbucketnumber = 4
where agingbucketnumber > 4
--Bucket 0 INVOICES
INSERT INTO #tmpAR2 (branchid, accountid, invoiceid, transactiondate, transactiondescription, eventname, InBucket01, siteid, programid, routeid)
SELECT branchid, accountid, invoiceid, transactiondate, dbo.fngetTransactionDescription(invoiceid,1) as description, eventname, invoicetotal, siteid, programid, routeid
FROM #tmpAR
WHERE agingbucketnumber = 0
AND invoicetotal > 0
--Bucket 0 PAYMENTS
INSERT INTO #tmpAR2 (branchid, accountid, paymentid, transactiondate, transactiondescription, eventname, InBucket01, siteid, programid, routeid)
SELECT branchid, accountid, paymentid, transactiondate, dbo.fngetTransactionDescription(paymentid,2) as description, eventname, paymenttotal*-1, siteid, programid, routeid
FROM #tmpAR
WHERE agingbucketnumber = 0
AND paymenttotal <> 0
--Bucket 1 INVOICE
INSERT INTO #tmpAR2 (branchid, accountid, invoiceid, transactiondate, transactiondescription, eventname, InBucket2, siteid, programid, routeid)
SELECT branchid, accountid, invoiceid, transactiondate, dbo.fngetTransactionDescription(invoiceid,1) as description, eventname, invoicetotal, siteid, programid, routeid
FROM #tmpAR
WHERE agingbucketnumber = 1
AND invoicetotal > 0
--Bucket 1 PAYMENT
INSERT INTO #tmpAR2 (branchid, accountid, paymentid, transactiondate, transactiondescription, eventname, InBucket2, siteid, programid, routeid)
SELECT branchid, accountid, paymentid, transactiondate, dbo.fngetTransactionDescription(paymentid,2) as description, eventname, paymenttotal*-1, siteid, programid, routeid
FROM #tmpAR
WHERE agingbucketnumber = 1
AND paymenttotal <> 0
--Bucket 2 INVOICES
INSERT INTO #tmpAR2 (branchid, accountid, invoiceid, transactiondate, transactiondescription, eventname, InBucket3, siteid, programid, routeid)
SELECT branchid, accountid, invoiceid, transactiondate, dbo.fngetTransactionDescription(invoiceid,1) as description, eventname, invoicetotal, siteid, programid, routeid
FROM #tmpAR
WHERE agingbucketnumber = 2
AND invoicetotal > 0
--Bucket 2 PAYMENT
INSERT INTO #tmpAR2 (branchid, accountid, paymentid, transactiondate, transactiondescription, eventname, InBucket3, siteid, programid, routeid)
SELECT branchid, accountid, paymentid, transactiondate, dbo.fngetTransactionDescription(paymentid,2) as description, eventname, paymenttotal*-1, siteid, programid, routeid
FROM #tmpAR
WHERE agingbucketnumber = 2
AND paymenttotal <> 0
--Bucket 3 (91-120 days) INVOICES
INSERT INTO #tmpAR2 (branchid, accountid, invoiceid, transactiondate, transactiondescription, eventname, InBucket4, siteid, programid, routeid)
SELECT branchid, accountid, invoiceid, transactiondate, dbo.fngetTransactionDescription(invoiceid,1) as description, eventname, invoicetotal, siteid, programid, routeid
FROM #tmpAR
WHERE agingbucketnumber = 3
AND invoicetotal > 0
--Bucket 3 (91-120 days) PAYMENTS
INSERT INTO #tmpAR2 (branchid, accountid, paymentid, transactiondate, transactiondescription, eventname, InBucket4, siteid, programid, routeid)
SELECT branchid, accountid, paymentid, transactiondate, dbo.fngetTransactionDescription(paymentid,2) as description, eventname, paymenttotal*-1, siteid, programid, routeid
FROM #tmpAR
WHERE agingbucketnumber = 3
AND paymenttotal <> 0
--Bucket 4 (over 120 days) INVOICES
INSERT INTO #tmpAR2 (branchid, accountid, invoiceid, transactiondate, transactiondescription, eventname, InBucket5, siteid, programid, routeid)
SELECT branchid, accountid, invoiceid, transactiondate, dbo.fngetTransactionDescription(invoiceid,1) as description, eventname, invoicetotal, siteid, programid, routeid
FROM #tmpAR
WHERE agingbucketnumber = 4
AND invoicetotal > 0
--Bucket 4 (over 120 days) PAYMENTS
INSERT INTO #tmpAR2 (branchid, accountid, paymentid, transactiondate, transactiondescription, eventname, InBucket5, siteid, programid, routeid)
SELECT branchid, accountid, paymentid, transactiondate, dbo.fngetTransactionDescription(paymentid,2) as description, eventname, paymenttotal*-1, siteid, programid, routeid
FROM #tmpAR
WHERE agingbucketnumber = 4
AND paymenttotal <> 0
--Prepay
INSERT INTO #tmpAR2 (branchid, accountid, prepayid, transactiondate, transactiondescription, eventname, prepay, siteid, programid, routeid)
SELECT branchid, accountid, prepayid, transactiondate, dbo.fngetTransactionDescription(prepayid,2) as description, eventname, prepay*-1, siteid, programid, routeid
FROM #tmpAR
WHERE prepay <> 0
DECLARE @InBucket01Total money
DECLARE @InBucket2Total money
DECLARE @InBucket3Total money
DECLARE @InBucket4Total money
DECLARE @InBucket5Total money
DECLARE @DebitBalance money
DECLARE @CreditBalance money
DECLARE @Balance money
--PROGRAM TOTALS
SELECT
INTO
#tmpProgramTotals
FROM
#tmpAR2
DECLARE @programid int
DECLARE @routeid int
WHILE (select COUNT(*) from #tmpProgramTotals) > 0
BEGIN
select top 1 @programid = programid, @routeid = routeid from #tmpProgramTotals
--Get Program Totals
select
@InBucket01Total = SUM(InBucket01),
@InBucket2Total = SUM(InBucket2),
@InBucket3Total = SUM(InBucket3),
@InBucket4Total = SUM(InBucket4),
@InBucket5Total = SUM(InBucket5),
@DebitBalance = SUM(InBucket01) + SUM(InBucket2) + SUM(InBucket3) + SUM(InBucket4) + SUM(InBucket5),
@CreditBalance = SUM(prepay),
@Balance = ((SUM(InBucket01) + SUM(InBucket2) + SUM(InBucket3) + SUM(InBucket4) + SUM(InBucket5)) + SUM(prepay))
from #tmpProgramTotals where programid = @programid and routeid = @routeid
UPDATE
#tmpAR2
SET
ProgramInBucket01 = @InBucket01Total,
ProgramInBucket2 = @InBucket2Total,
ProgramInBucket3 = @InBucket3Total,
ProgramInBucket4 = @InBucket4Total,
ProgramInBucket5 = @InBucket5Total,
ProgramDebit = @DebitBalance,
ProgramCredit = @CreditBalance,
ProgramBalance = @Balance
WHERE
programid = @programid
AND routeid = @routeid
delete #tmpProgramTotals where programid = @programid and routeid = @routeid
END
DROP TABLE #tmpProgramTotals
CREATE TABLE #tmpIncludedprepay (paymentid int)
SELECT
INTO
#tmpProgramCredits
FROM
#tmpAR2
WHILE (select COUNT(*) from #tmpProgramCredits) > 0
BEGIN
select top 1 @programid = programid, @routeid = routeid from #tmpProgramCredits
declare @programcreditbalance money
select @programcreditbalance = ProgramCredit from #tmpAR2 where programid = @programid and routeid = @routeid
while @programcreditbalance < 0
BEGIN
declare @creditamount money
declare @paymentid int
select top 1 @creditamount = prepay, @paymentid = prepayid
from #tmpAR2
where programid = @programid and routeid = @routeid
and prepayid <> 0 and prepayid not in (select paymentid from #tmpIncludedprepay)
and prepay < 0
order by transactiondate desc
insert into #tmpIncludedprepay values (@paymentid)
if @programcreditbalance - @creditamount > 0
BEGIN
UPDATE
#tmpAR2
SET
prepay = @programcreditbalance
WHERE
prepayid = @paymentid
END
set @programcreditbalance = @programcreditbalance - @creditamount
END
delete #tmpProgramCredits where programid = @programid and routeid = @routeid
END
DROP TABLE #tmpProgramCredits
DELETE FROM #tmpAR2
WHERE prepayid <> 0 AND prepayid not in (select paymentid from #tmpIncludedprepay)
DROP TABLE #tmpIncludedprepay
SELECT
acct.accountid,
acct.accountnum,
br.branchid,
br.branchname,
r.routeid,
r.routename,
CASE scontact.businessname WHEN '' THEN scontact.lastname + '. ' + scontact.firstname ELSE scontact.businessname END as Name,
sphone.phonenumber,
CASE WHEN prog.canceldate is not null THEN 'Cancelled'
ELSE CASE WHEN prog.pendingcanceldate is not null THEN 'Pending Cancel'
ELSE CASE WHEN prog.warrantyexpirationdate <= @asofdate THEN 'Expired'
ELSE 'Active' END
END
END as programstatus,
CASE WHEN prog.canceldate is not null THEN 3
ELSE CASE WHEN prog.pendingcanceldate is not null THEN 4
ELSE CASE WHEN prog.warrantyexpirationdate <= @asofdate THEN 2
ELSE 1 END
END
END as programstatus_indicator,
prog.programid,
convert(varchar, transactiondate, 101) as transactiondate,
transactiondescription,
eventname,
(CASE WHEN prepay <> 0 then prepay else InBucket01 END) as InBucket01,
InBucket2,
InBucket3,
InBucket4,
InBucket5,
ProgramDebit,
ProgramCredit,
ProgramBalance,
ProgramInBucket01,
ProgramInBucket2,
ProgramInBucket3,
ProgramInBucket4,
ProgramInBucket5,
RouteInBucket01,
RouteInBucket2,
RouteInBucket3,
RouteInBucket4,
RouteInBucket5,
RouteDebit,
RouteCredit,
RouteBalance,
BranchInBucket01,
BranchInBucket2,
BranchInBucket3,
BranchInBucket4,
BranchInBucket5,
BranchDebit,
BranchCredit,
BranchBalance,
Detail = 1,
Age = CASE @ageperiod
WHEN 0 THEN 'Debits'
WHEN 1 THEN 'Credits'
WHEN 2 THEN '31-60 Days and older'
WHEN 3 THEN '61-90 Days and older'
WHEN 4 THEN '91-120 Days and older'
WHEN 5 THEN '120 Days and older'
WHEN -999 THEN 'All Balance'
END,
PropertyType = CASE sit.propertytype
WHEN 1 THEN 'Residential'
WHEN 2 THEN 'Commercial'
WHEN 5 THEN 'National'
ELSE ''
END
INTO
#results
FROM
#tmpAR2
INNER JOIN taccount acct ON acct.accountid = #tmpAR2.accountid
INNER JOIN tbranch br ON br.branchid = #tmpAR2.branchid
INNER JOIN troute r ON r.routeid = #tmpAR2.routeid
INNER JOIN tprogram prog ON prog.programid = #tmpAR2.programid
INNER JOIN testimate est ON est.estimateid = prog.estimateid
INNER JOIN tsite sit ON sit.siteid = est.siteid
INNER JOIN tcontact scontact on acct.primarycontactid = scontact.contactid
INNER JOIN taddress saddr on acct.billingaddressid = saddr.addressid
LEFT JOIN tcontactphonenumber sphone ON scontact.primaryphoneid = sphone.phoneid
WHERE
--Debit Balance
(@ageperiod <> 0 OR ProgramBalance > 0)
--Credit Balance
AND (@ageperiod <> 1 OR ProgramBalance < 0)
--31-60 Days and older
AND (@ageperiod <> 2 OR (ProgramInBucket2 > 0 or ProgramInBucket3 > 0 or ProgramInBucket4 > 0 or ProgramInBucket5 > 0))
--61-90 Days and older
AND (@ageperiod <> 3 OR (ProgramInBucket3 > 0 or ProgramInBucket4 > 0 or ProgramInBucket5 > 0))
--90 Days and older
AND (@ageperiod <> 4 OR (ProgramInBucket4 > 0 or ProgramInBucket5 > 0))
--120 Days and older
AND (@ageperiod <> 5 OR ProgramInBucket5 > 0)
-- property type
AND (@propertytype = -999 OR sit.propertytype = @propertytype)
--Need to add a line with null values for the timeline if details are not showing
IF @showdetails = 0
BEGIN
INSERT INTO
#results
SELECT DISTINCT
--TFS-8903 .. JL ... 2/12/2014
accountid,
accountnum, branchid, branchname, routeid, routename, Name,
phonenumber, programstatus,programstatus_indicator,programid, null, null, null,
null, null, null, null, null,
ProgramDebit,ProgramCredit, ProgramBalance,
ProgramInBucket01, ProgramInBucket2, ProgramInBucket3, ProgramInBucket4, ProgramInBucket5,
RouteInBucket01, RouteInBucket2, RouteInBucket3, RouteInBucket4, RouteInBucket5,
RouteDebit, RouteCredit, RouteBalance,
BranchInBucket01, BranchInBucket2, BranchInBucket3, BranchInBucket4, BranchInBucket5,
BranchDebit, BranchCredit, BranchBalance,
0, Age, PropertyType
FROM
#results
DELETE FROM #results
WHERE Detail = 1
END
IF @programstatus <> -999 AND @programstatus <> 1 -- ACTIVE
BEGIN
DELETE r
FROM
#results r
INNER JOIN tprogram p
ON r.programid = p.programid
WHERE
r.programstatus_indicator = 1
END
IF @programstatus <> -999 AND @programstatus <> 2 -- Expired
BEGIN
DELETE r
FROM
#results r
INNER JOIN tprogram p
ON r.programid = p.programid
WHERE
r.programstatus_indicator = 2
END
IF @programstatus <> -999 AND @programstatus <> 3 -- CANCELLED
BEGIN
DELETE r
FROM
#results r
INNER JOIN tprogram p
ON r.programid = p.programid
WHERE
r.programstatus_indicator = 3
END
IF @programstatus <> -999 AND @programstatus <> 4 -- PENDING CANCEL
BEGIN
DELETE r
FROM
#results r
INNER JOIN tprogram p
ON r.programid = p.programid
WHERE
r.programstatus_indicator = 4
END
SELECT
branchid,
routeid
INTO
#branchesRoutes
FROM
tbranchroute
IF @branchid <> -999
BEGIN
DELETE FROM #branchesRoutes
WHERE branchid <> @branchid
END
SELECT
accountid = ISNULL(res.accountid,0),
accountnum = ISNULL(res.accountnum, ''),
branchid = b.branchid,
branchname = b.branchname,
routeid = r.routeid,
routename = r.routename,
Name = ISNULL(Name,''),
phonenumber,
programstatus,
programid = ISNULL(programid,0),
transactiondate = transactiondate,
transactiondescription,
eventname,
detail0to30 = InBucket01,
detail31to60 = InBucket2,
detail61to90 = InBucket3,
detailOver90 = InBucket4,
detailOver120 = InBucket5,
ProgramDebit = ISNULL(ProgramDebit,0),
ProgramCredit = ISNULL(ProgramCredit,0),
ProgramBalance = ISNULL(ProgramBalance,0),
Program0to30 = ISNULL(ProgramInBucket01,0),
Program31to60 = ISNULL(ProgramInBucket2,0),
Program61to90 = ISNULL(ProgramInBucket3,0),
ProgramOver90 = ISNULL(ProgramInBucket4,0),
ProgramOver120 = ISNULL(ProgramInBucket5,0),
Route0to30 = ISNULL(RouteInBucket01,0),
Route31to60 = ISNULL(RouteInBucket2,0),
Route61to90 = ISNULL(RouteInBucket3,0),
RouteOver90 = ISNULL(RouteInBucket4,0),
RouteOver120 = ISNULL(RouteInBucket5,0),
RouteDebit = ISNULL(RouteDebit,0),
RouteCredit = ISNULL(RouteCredit,0),
RouteBalance = ISNULL(RouteBalance,0),
Branch0to30 = ISNULL(BranchInBucket01,0),
Branch31to60 = ISNULL(BranchInBucket2,0),
Branch61to90 = ISNULL(BranchInBucket3,0),
BranchOver90 = ISNULL(BranchInBucket4,0),
BranchOver120 = ISNULL(BranchInBucket5,0),
BranchDebit = ISNULL(BranchDebit,0),
BranchCredit = ISNULL(BranchCredit,0),
BranchBalance = ISNULL(BranchBalance,0),
ISNULL((select top 1 tfinancestatussetup.financestatus
from tevent inner join tfinancestatussetup on tevent.financestatusid = tfinancestatussetup.financestatusid
inner join tprogram on tevent.programid = tprogram.programid
inner join #results r2 on r2.programid = tprogram.programid
inner join testimate on testimate.estimateid = tprogram.estimateid
where testimate.accountid = res.accountid
order by tevent.submitteddate desc), '') as racstatus,
Detail = ISNULL(Detail,0),
Age,
Case
when (acc.allowautobill = 1) or
(select count(accp.programid) from taccountebaprogram accp
where accp.accountid = acc.accountid ) > 0 then 'Auto Pay'
else ''
END as StatusNote,
CASE @sortby
WHEN 'name' THEN 1
ELSE 0
END as Sort,
PropertyType,
hasservices = CASE WHEN res.accountid IS NULL THEN 0 ELSE 1 END
INTO
#results2
FROM
#results res
inner join taccount acc on acc.accountid=res.accountid
inner join #branchesRoutes br on br.routeid = res.routeid AND br.branchid = res.branchid
inner join troute r ON r.routeid = br.routeid
inner join tbranch b on b.branchid = br.branchid
--Set Route Totals
SELECT
routeid,
SUM(ProgramInBucket01) as RouteInBucket01,
SUM(ProgramInBucket2) as RouteInBucket2,
SUM(ProgramInBucket3) as RouteInBucket3,
SUM(ProgramInBucket4) as RouteInBucket4,
SUM(ProgramInBucket5) as RouteInBucket5, --xx
SUM(ProgramDebit) as RouteDebit,
SUM(ProgramCredit) as RouteCredit,
SUM(ProgramBalance) as RouteBalance
INTO
#routetotals
FROM
(select distinct
routeid, programid, ProgramInBucket01, ProgramInBucket2, ProgramInBucket3, ProgramInBucket4, ProgramInBucket5, ProgramDebit, ProgramCredit, ProgramBalance
from
#results
) t
GROUP BY
routeid
UPDATE
#results2
SET
Route0to30 = t.RouteInBucket01,
Route31to60 = t.RouteInBucket2,
Route61to90 = t.RouteInBucket3,
RouteOver90 = t.RouteInBucket4,
RouteOver120 = t.RouteInBucket5,
RouteDebit = t.RouteDebit,
RouteCredit = t.RouteCredit,
RouteBalance = t.RouteBalance
FROM
#results2
INNER JOIN #routetotals t on t.routeid = #results2.routeid
--Set Branch Totals
SELECT
branchid,
SUM(Route0to30) as BranchInBucket01,
SUM(Route31to60) as BranchInBucket2,
SUM(Route61to90) as BranchInBucket3,
SUM(RouteOver90) as BranchInBucket4,
SUM(RouteOver120) as BranchInBucket5,
SUM(RouteDebit) as BranchDebit,
SUM(RouteCredit) as BranchCredit,
SUM(RouteBalance) as BranchBalance
INTO
#branchtotals
FROM
(select distinct
branchid, routeid, Route0to30, Route31to60, Route61to90, RouteOver90, RouteOver120, RouteDebit, RouteCredit, RouteBalance
from
#results2
) t
GROUP BY
branchid
UPDATE
#results2
SET
Branch0to30 = t.BranchInBucket01,
Branch31to60 = t.BranchInBucket2,
Branch61to90 = t.BranchInBucket3,
BranchOver90 = t.BranchInBucket4,
BranchOver120 = t.BranchInBucket5,
BranchDebit = t.BranchDebit,
BranchCredit = t.BranchCredit,
BranchBalance = t.BranchBalance
FROM
#results2
INNER JOIN #branchtotals t on t.branchid = #results2.branchid
SELECT * FROM #results2 -- order by routeid, branchid
drop table #branchesRoutes
drop table #tmpAR
drop table #branchtotals
drop table #routetotals
drop table #tmpAR2
drop table #results
drop table #results2
drop table #mecs
END

Use this tool on my web site:
http://www.sommarskog.se/sqlutil/sqltrace.html
The stored procedure sp_sqltrace sets up a trace filtered for you own spid, and accepts a command batch, which in your case is a call to your stored procedure. It will aggregrate the data per statement. This procedure helps you identify what is taking time.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • EP6 sp12 Performance Issue, Need help to improve performance

    We have a Portal development environment with EP6.0 sp12.
    What we are experiencing is performance issue, It's not extremely slow, but slow compared to normal ( compared to our prod box). For example, after putting the username and password and clicking the <Log on> Button it's taking more than 10 secs for the first home page to appear. Also currently we have hooked the Portal with 3 xAPPS system and one BW system. The time taken for a BW query to appear ( with selection screen) is also more than 10 secs. However access to one other xAPPS is comparatively faster.
    Do we have a simple to use guide( Not a very elaborate one) with step by step guidance to immediately improve the performance of the Portal.
    Simple guide, easy to implement,  with immediate effect is what we are looking for in the short term
    Thanks
    Arunabha

    Hi Eric,
      I have searched but didn't find the Portal Tuning and Optimization Guide as you have suggested, Can you help to find this.
    Subrato,
      This is good and I would obviously read through this, The issue here is this is only for Network.
      But do you know any other guide, which as very basic ( may be 10 steps) and show step by step the process, it would be very helpful. I already have some information from the thread Portal Performance - page loads slow, client cache reset/cleared too often
    But really looking for answer ( steps to do it quickly and effectively) instead of list of various guides.
    It would be very helpful if you or anybody( who has actually done some performance tuning) can send  a basic list of steps that I can do immediately, instead of reading through these large guides.
    I know I am looking for a shortcut, but this is the need of the hour.
    Thanks
    Arun

  • Need help with premiere pro cs6 having performance issues please help

    need help with premiere pro cs6 having performance issues please help

    Welcome to the forum.
    First thing that I would do would be to look at this Adobe KB Article to see if it helps.
    Next, I would try the tips in this ARTICLE.
    If that does not help, a Repair Install would definitely be in order.
    Good luck,
    Hunt

  • Spry Menu Bar issue, NEED HELP...???

    Here is the coding for a menu bar that i created with CS3, for some reason i am having an issue when i open the web page in IE, on firefox and safari it looks fine, the menu drops down to sub menu's fine, but for some reason when i open it in IE, the submenu's show on the very top of the page rather than right below the menu itself, please check my coding and see if there is an issue???
    i ran compatability and there are no issues shown.
    @charset "UTF-8";
    /* SpryMenuBarHorizontal.css - Revision: Spry Preview Release 1.4 */
    /* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
    LAYOUT INFORMATION: describes box model, positioning, z-order
    /* The outermost container of the Menu Bar, an auto width box with no margin or padding */
    ul.MenuBarHorizontal
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        cursor: default;
        width: auto;
    /* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
    ul.MenuBarActive
        z-index: 1000;
    /* Menu item containers, position children relative to this container and are a fixed width */
    ul.MenuBarHorizontal li
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        position: relative;
        text-align: left;
        cursor: pointer;
        width: 10.4em;
        float: left;
        background-image: url(tab2.png);
    /* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
    ul.MenuBarHorizontal ul
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        z-index: 1020;
        cursor: default;
        width: 8.2em;
        position: absolute;
        left: -1000em;
        text-decoration: underline;
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
        left: auto;
        background-image: url(../tab1.png);
    /* Menu item containers are same fixed width as parent */
    ul.MenuBarHorizontal ul li
        width: 8.2em;
    /* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
    ul.MenuBarHorizontal ul ul
        position: absolute;
        margin: -5% 0 0 95%;
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
        left: auto;
        top: 0;
    DESIGN INFORMATION: describes color scheme, borders, fonts
    /* Submenu containers have borders on all sides */
    ul.MenuBarHorizontal ul
    /* Menu items are a light gray block with padding and no text decoration */
    ul.MenuBarHorizontal a
        display: block;
        cursor: default;
        padding: 0.5em 0.75em;
        color: #FFFFFF;
        text-decoration: none;
        border-left-color: #0063bd;
        border-right-color: #0063bd;
        border-right-width: 3px;
        border-left-width: thin;
        font-family: Calibri;
        font-weight: bold;
        font-size: 19px;
    /* Menu items that have mouse over or focus have a blue background and white text */
    ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
        color: #000000;
    /* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
    ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
        color: #000000;
    SUBMENU INDICATION: styles if there is a submenu under a given menu item
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenu
        background-image: url(SpryMenuBarDown.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenu
        background-image: url(SpryMenuBarRight.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenuHover
        background-image: url(SpryMenuBarDownHover.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover
        background-image: url(SpryMenuBarRightHover.gif);
        background-repeat: no-repeat;
        background-position: 95% 50%;
    BROWSER HACKS: the hacks below should not be changed unless you are an expert
    /* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */
    ul.MenuBarHorizontal iframe
        position: absolute;
        z-index: 1010;
    /* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
    @media screen, projection
        ul.MenuBarHorizontal li.MenuBarItemIE
        display: inline-block;
        f\loat: left;
        position: relative;

    Hey gramps, thanks for the info, i have updated my spry framework to 1.6.1 but the problem is still the same, i recreated my menu with the new 1.6 and it still doing the same thing, the submenu's are like vertically reversed... ugh need help.
    here the new code
    @charset "UTF-8";
    /* SpryMenuBarHorizontal.css - version 0.6 - Spry Pre-Release 1.6.1 */
    /* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
    LAYOUT INFORMATION: describes box model, positioning, z-order
    /* The outermost container of the Menu Bar, an auto width box with no margin or padding */
    ul.MenuBarHorizontal
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        cursor: default;
        width: auto;
    /* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
    ul.MenuBarActive
        z-index: 1000;
    /* Menu item containers, position children relative to this container and are a fixed width */
    ul.MenuBarHorizontal li
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        position: relative;
        text-align: left;
        cursor: pointer;
        width: 10.4em;
        float: left;
    /* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
    ul.MenuBarHorizontal ul
        margin: 0;
        padding: 0;
        list-style-type: none;
        font-size: 100%;
        z-index: 1020;
        cursor: default;
        width: 8.2em;
        position: absolute;
        left: -1000em;
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
        left: auto;
        background-image: url(../tab1.png);
        line-height: 18px;
    /* Menu item containers are same fixed width as parent */
    ul.MenuBarHorizontal ul li
        width: 8.2em;
    /* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
    ul.MenuBarHorizontal ul ul
        position: absolute;
        margin: -5% 0 0 95%;
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
        left: auto;
        top: 0;
    DESIGN INFORMATION: describes color scheme, borders, fonts
    /* Submenu containers have borders on all sides */
    ul.MenuBarHorizontal ul
        border: 1px solid #CCC;
    /* Menu items are a light gray block with padding and no text decoration */
    ul.MenuBarHorizontal a
        display: block;
        cursor: pointer;
        padding: 0.5em 0.75em;
        color: #FFFFFF;
        text-decoration: none;
        font-size: 19px;
        font-family: Calibri;
        font-weight: bolder;
    /* Menu items that have mouse over or focus have a blue background and white text */
    ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
        color: #000000;
    /* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
    ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
        color: #000000;
    SUBMENU INDICATION: styles if there is a submenu under a given menu item
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenu
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenu
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal a.MenuBarItemSubmenuHover
        background-repeat: no-repeat;
        background-position: 95% 50%;
    /* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
    ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover
        background-repeat: no-repeat;
        background-position: 95% 50%;
    BROWSER HACKS: the hacks below should not be changed unless you are an expert
    /* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */
    ul.MenuBarHorizontal iframe
        position: absolute;
        z-index: 1010;
    /* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
    @media screen, projection
        ul.MenuBarHorizontal li.MenuBarItemIE
        display: inline;
        f\loat: left;

  • Concurrent crystal license timeout Issue, need help.

    Hi,
    My company is using crystal enterprise 10 with 18 concurrent user license.
    However, we often hit out of crystal license issues.
    Does time to wait for exporting crystal reports to excel/pdf takes up licenses?
    Does time to wait for crystal report to be printed or viewed on the web browser takes up licenses?
    We all know that user sessions take up user licenses. 1 user login take up 1 license.
    Does crystal pruning job takes up user licenses too?
    Need help urgently, much appreciated.

    Hi Daren,
    Support on Cystal Enterprise 10 has expired. Make sure that your users are actually logging off and not just closing their browser.
    One user can take up multiple licenses by not logging off or opening multiple browsers to view multiple reports. Scheduled jobs that are running do not take up license, but a user veiwing a historical instance does take up a license.
    In your metrics tab in the Cyrsatl Management Console -> Servers-> cms you should be able to see the active number of sessions- system connections are backend connections between the servers and these do not take up any licenses.
    Best Regards,
    Jadie

  • T400 LCD dim issue - Need help!!

    I'm having a LCD dim issue with a T400. Have changed the LCD panel, LCD cable and systemboard but still having same issue. If i removed the lcd card, then the display is working fine. I've tested the lcd card in another working unit and it's working as well (means the lcd card is working). I use a working lcd card and plug into this T400 but LCD still dim. 
    I've try to switch the problematic lcd cable and lcd panel to a working systemboard and it kills the systemboard. Have try to switch a few things but still unable to find the root cause. Urgently need help on this. Any advice will be appreciated.
    Model : 6475-RM5

    hey bhoh
    i suggest uninstalling your current graphic card driver, let windows install its own generic drivers and see if that makes any difference
    WW Social Media
    Important Note: If you need help, post your question in the forum, and include your system type, model number and OS. Do not post your serial number.
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"!
    Follow @LenovoForums on Twitter!
    Have you checked out the Community Knowledgebase yet?!
    How to send a private message? --> Check out this article.

  • Stuttering flv playback issue- need help asap

    We need help asap. Have a project is due to deliver today (5/14).
    We have a video to go on a dvd-rom, live action with Motion Graphics behind.
    When output is done thru Projector the Motion Graphics stutter as they scroll.
    Here is more technical info:
    Stuttering flv playback issue:
    Prores 422 timeline 29.97fps 1280x720 output from fcp using current settings.
    Mov file is approx 7gb, plays relatively smooth on a mac pro with no raid.
    Frame by frame analysis shows all frames are present with no jumps tears or skips.
    Tried several output paths, programs and settings to create a smooth flv file to no avail.
    We adjusted data rates from 2k, 3.5k, 4k and 8k, no luck
    We adjusted keyframe rates from low to all frames, no luck.
    We tried cs3 flash encoder, cs5 media encoder, squeeze ect, same results.
    Playback in the flash projector seems to choke slightly no matter what we do.
    Have also posted in the Director Forum.
    Any help much appreciated!

    Here are a few ideas off the top of my head:
    Try playing the file using a different xtra, sometimes different ones will work better.  If you have Director 11.5, there is a native flv playback xtra.
    You can build a player easily in Flash using the flvPlayback component, then bring that into Director as a swf.
    Once you have the video in Director, try making the member Direct To Stage (DTS).  If it is already DTS, try making it not DTS.
    Make sure the video is not transparent, and nothing in Director overlaps the video... in fact, when the video is playing, nothing should be moving at all, and try to keep the amount of code that is running to a minimum.
    Try lowering your video's data rate further or try using a different codec.
    Using VBR (Variable Bit Rate) compression often makes the video appear to play smoother.
    Try compressing the flv with different software.  FFMpeg, for example, is free and does a very good job, often better than the Flash Video Encoder that comes with Flash/Creative Suite.

  • RSI Issue: Need help on IBM/Lenovo external keyboards w Trackpoint? Pic

    Need help on IBM/Lenovo external keyboards w Trackpoint? Pic
    I started my journey with Thinkpads on a T42, then T43.. then T61, X61T, R61 & T410 (bought for 2 cousins & they love it), W510 (dads new laptop). I may be a much recent convert but I swear by them now. 
    MAJOR ISSUE: Recently started feeling RSI (Repetitive Stress) & Carpal Tunnel symptoms (already doing stretches.. adjusted the desk.. & finding new adjustable LCD stand) since I am not using the Thinkpad directly... but using it docked with an External keyboard. Lot of Mousing as well. I'd like to go back to Thinkpad FEEL... or atleast have keyboard with a pointing device so my hands dont have to keep moving back n forth. 
    So, it would be great it some of my fellow T4x/T6x/X6x 'ers would guide me a bit on this... share their first hand experience, or what they've seen on these keyboards and feel free to point me to reliable sources of information. 
    Currently this would greatly be use with T61 - Adv Mini Dock - 30" XHD3000 LCD as shown in my signature below. 
    Anyone who has used or know something about one of these Thinkpad related keyboard (ideally both of these to give a comparative response). 
    Which of the following have you used? 
    How was the experience? 
    (Maybe point me to thread with peoples experiences)
    If you've used several, which one do you prefer / recommend? Why? 
    At the moment I have a "slim" BTC 6200C desktop keyboard. It has laptop like scissor keyswitches, so I like it the slim notebook like profile. 
    The way I have positioned my 30" LCD I'd like to be able to keep the keyboard on my lap at times while on my chair and maybe on the desk at times. 
    ThinkPad Full-Size UltraNav USB Keyboard 
    The keyboard and trackpad of the IBM Lenovo Thinkplus USB Keyboard with Ultranav:
    ThinkPad Travel UltraNav USB Keyboard 
    The travel version of the above:
    Newer: 
    ThinkPad USB Keyboard with TrackPoint
    A 2009 replacement for the previous one but not the full keyboard nor wireless: 
    Thinkpads:
    T61 8892-02U: 14.1"SXGA+/2.2C2D/4G/XP|Adv Mini Dock|30" Gateway XHD3000 WQXGA via Dual-link DVI
    X61T 7767-96U: 12.1"SXGA+/1.6C2D/3G/Vista|Ultrabase
    W510 4319-2PU: 15.6"FHD/i7-720QM/4G/Win7Pro64 (for dad)
    T43 1875-DLU: 14.1"XGA/1.7PM-740/1G/XP
    Dell:
    Inspiron 9300: 17"WUXGA/NVidiaGeForce6800/2.2PM/2G/XP (old)

    I had the same issue - had to go to voice command for a few weeks (sucked) wore wrist gards to keep things netural.
    Everything went away when I changed to a USB keyboard with the Ultra nav (I use the track point and disable the pad).
    I've been working like that for 6+ years now... no issues.
    (as a side note, sleeping with wrist guards on helped heal me the fastest.  I had neoprine, with a metal plate in them - from a local drug store)

  • LCD monitor display issue, need help

    I have a strange problem with my LCD display, it goes like this:
    When I first boot up the mac and the wallpaper appears on the display the image looks perfect, all the tones are right etc, but as the startup progresses, programs loading etc, the display changes suddenly, becomes too bright in the highs, too dark in the lows, and over-saturated in between. Its looks horrible.
    I have just discovered that I can correct the issue by going into system prefs, display, selecting the options tab (next to Display and Color) and turning overscan on, then back off, voila, all fixed.
    Looks great.
    Thing is I have to do this every time now that I start the computer, and Im wondering if anyone knows what causes this issue and if theres anything I can do as a more robust solution.
    The kicker is I have the same problem with a viewsonic LCD on my secondary machine (Powermac G5, Osx 10.4), right at the beginning of startup it looks great then suddenly all goes wrong, too dark/light over-saturated. Its as if the image has been blended with itself in multiply mode a la photoshop.
    And on my second machine there is no option for overscan so I cant use my quick fix.
    Is overscan a feature of the OS or the monitor?
    The worst part is I need these displays to work correctly because Im a graphic designer, I need my colors to look right so I can do my job, and while I could go buy a $1000 monitor its not possible atm, and Id kinda like to know why this problem occurs. So if I do buy a different I can be assured the problem wont rear its ugly head again. But I dont think the problme is the monitor. I think its something to do with the communication between the display and the computer.
    The monitor can display correctly, and does for a brief moment, then it all goes very wrong. Ive spoken to NEC and they werent much help but Ill be trying them again today too.
    But again, I thinks its the computer, not the monitors as I can reproduce the issue swapping out monitors.
    I hope Ive described it adequately,
    Thanks in advance for any help forthcoming, this is very frustrating and is causing me endless headaches.

    Mattdp,
    I am currently having the same problem with my 20" cinema display. Did you ever find a long term solution? Apple states that the PowerMac G5 is legacy with no support available, and suggested a reset the PRAM. I did so to no avail. I too have 10.4.11 and thus no "overscan" to turn off. This is my wife's primary computer for her photography business, and the color issue needs to be resolved as quickly as I can find the answer.
    Is there a possible solution through the terminal?
    Rick

  • Odd mail issues, need help

    A couple of things I need help with.
    1) Mail constantly goes offline and pops up a dialog box asking for my password. I enter my password in the box and hit okay and it doesn't take. I can hit cancel and put mail back online but that's a pain. What is causing that and how do I fix it?
    2) People send me mail and then about 30 min later I get the same email again. This problem doesn't happen with every email, just some.
    I have no mail rules on. and I run virus software and it's fine.
    Can someone please help me on this. Thanks!
    1.25 GHz PPC G4 / 20"   Mac OS X (10.3.9)   768 MB DDR SDRAM, iSight camera, Wacom Tablet

    Open /Applications/Utilities/Keychain Access, choose Keychain First Aid from the application menu, and proceed to repair the keychain. If that doesn’t work, you may try removing the password entry from the keychain and letting Mail create it again.
    Also, in Mail open Help > Mail Help and read the article titled “Mail keeps asking for my keychain password”, in case it applies to you. There is a related article titled “My password is not saved” that you may also want to read, but beware that the last suggestion provided there (deleting the mail account) is wrong and could cause irretrievable data loss if this was a POP account.
    Note that Mail doesn’t always correctly report what the problem really is. If Mail can connect to the server but cannot log into your mail account for some reason, it’ll ask for your password, regardless of whether that’s really the problem or not. Don’t keep entering the password every time, because that’s not the problem (click Cancel instead, and take the account back online afterwards).
    What’s the time interval chosen in Mail > Preferences > General > Check for New Mail? If it’s set to Every minute, try changing it to Every 5 minutes.
    Go to Apple Menu > System Preferences > Network, choose Network Port Configurations from the Show popup menu, and make sure that the configuration used to connect to Internet appears at the top of the list.
    Also, try using a different method to connect to Internet, if possible, or connecting the computer to Internet as directly as possible, i.e. bypassing any routers that might be present, using an ethernet cable instead of wireless, etc., and see whether that makes a difference.
    BTW, if you’re using Mac OS X 10.3, as your profile indicates, it would have been more appropriate to discuss this in the Mail & Address Book - Mac OS X 10.3 & earlier forum. If the discussion applies to both Mail 1.x and Mail 2.x, it doesn’t really matter, but it’s difficult to know that in advance.

  • HP NC2400 Drive cable issue : need help

    Can someone please send a picture of what an installed zif harddrive drive for an NC2400 looks like ? Does it go topside up or down ? How does the cable look when installed ? Need help. Does anyone have a spare harddrive cable ?
    Any help would be much appreciated!!
    Bill C.

    This manual shows the drive with the metal side Up
    http://h10032.www1.hp.com/ctg/Manual/c00741440.pdf
    Service manual here, it does not show the cable as a separate part of part number
    Click Me
    You will need to contact HP parts
    http://partsurfer.hp.com/ContactUs.aspx

  • Need performance! - Need help with Server Architecture for SSAS on Azure VM

    I would like to build 100% Azure VM base solution. We can install as many as needed.
    I have large amount data in DW. (100GB-1000GB)
    I would like to provide PowerView reports in SharePoints.
    I would like to have report data be as real time as possible. (Min data is updated once in 2 hours)
    These are requirements:
    -SharePoint 2013
    -PowerView
    -SSAS OLAP Cube
    -SQL Server DW&Staging DB (Currently DW&Staging on same server)
    I need help specially what can be done with SSAS to meet requirements? Should be installed to own application server? Possible to install multiple SSAS? SSRS needs own server?
    I appreciate also links to server topology diagrams.
    Kenny_I

    I assume you mean 100GB-1000GB (not 1000TB) right?
    For Sharepoint I would refer to the sizing guide for diagrams and sizing:
    http://technet.microsoft.com/en-us/library/ff758647(v=office.15).aspx
    SSRS (and Power View) will run in the SharePoint farm on a SharePoint app server potentially with other SharePoint services.
    I would definitely put SSAS on a dedicated server for a cube that size. Depending on how well your data compresses, there may not be a VM in Azure with enough RAM to put your model into a Tabular SSAS model. I would prototype it with a subset of data to see
    how well it compresses. You can always use a Multidimensional model as a fallback.
    Depending on how much processing the SSAS model impacts user queries (since it is happening during the day) you could build an SSAS processing server and a separate SSAS query server and run the XMLA Synchronize command to copy the cube incrementally from processing
    to query servers.
    Does that help?
    http://artisconsulting.com/Blogs/GregGalloway

  • How to resolve most of the Oracle SQL , PL/SQL Performance issues with help of quick Checklist/guidelines ?

    Please go thru below important checklist/guidelines to identify issue in any Perforamnce issue and resolution in no time.
    Checklist for Quick Performance  problem Resolution
    ·         get trace, code and other information for given PE case
              - Latest Code from Production env
              - Trace (sql queries, statistics, row source operations with row count, explain plan, all wait events)
              - Program parameters & their frequently used values
              - Run Frequency of the program
              - existing Run-time/response time in Production
              - Business Purpose
    ·         Identify most time consuming SQL taking more than 60 % of program time using Trace & Code analysis
    ·         Check all mandatory parameters/bind variables are directly mapped to index columns of large transaction tables without any functions
    ·         Identify most time consuming operation(s) using Row Source Operation section
    ·         Study program parameter input directly mapped to SQL
    ·         Identify all Input bind parameters being used to SQL
    ·         Is SQL query returning large records for given inputs
    ·         what are the large tables and their respective columns being used to mapped with input parameters
    ·         which operation is scanning highest number of records in Row Source operation/Explain Plan
    ·         Is Oracle Cost Based Optimizer using right Driving table for given SQL ?
    ·         Check the time consuming index on large table and measure Index Selectivity
    ·         Study Where clause for input parameters mapped to tables and their columns to find the correct/optimal usage of index
    ·         Is correct index being used for all large tables?
    ·         Is there any Full Table Scan on Large tables ?
    ·         Is there any unwanted Table being used in SQL ?
    ·         Evaluate Join condition on Large tables and their columns
    ·         Is FTS on large table b'cos of usage of non index columns
    ·         Is there any implicit or explicit conversion causing index not getting used ?
    ·         Statistics of all large tables are upto date ?
    Quick Resolution tips
    1) Use Bulk Processing feature BULK COLLECT with LIMIT and FOR ALL for DML instead of row by row processing
    2) Use Data Caching Technique/Options to cache static data
    3) Use Pipe Line Table Functions whenever possible
    4) Use Global Temporary Table, Materialized view to process complex records
    5) Try avoiding multiple network trips for every row between two database using dblink, Use Global temporary table or set operator to reduce network trip
    6) Use EXTERNAL Table to build interface rather then creating custom table and program to Load and validate the data
    7) Understand Oracle's Cost based Optimizer and Tune most expensive SQL queries with help of Explain plan
    8) Follow Oracle PL/SQL Best Practices
    9) Review tables and their indexes being used in the SQL queries and avoid unnecessary Table scanning
    10) Avoid costly Full Table Scan on Big Transaction tables with Huge data volume,
    11) Use appropriate filtration condition on index columns of seeded Oracle tables directly mapped to program parameters
    12) Review Join condition on existing query explain plan
    13) Use Oracle hint to guide Oracle Cost based optimizer to choose best plan for your custom queries
    14) Avoid applying SQL functions on index columns
    15) Use appropriate hint to guide Oracle CBO to choose best plan to reduce response time
    Thanks
    Praful

    I understand you were trying to post something helpful to people, but sorry, this list is appalling.
    1) Use Bulk Processing feature BULK COLLECT with LIMIT and FOR ALL for DML instead of row by row processing
    No, use pure SQL.
    2) Use Data Caching Technique/Options to cache static data
    No, use pure SQL, and the database and operating system will handle caching.
    3) Use Pipe Line Table Functions whenever possible
    No, use pure SQL
    4) Use Global Temporary Table, Materialized view to process complex records
    No, use pure SQL
    5) Try avoiding multiple network trips for every row between two database using dblink, Use Global temporary table or set operator to reduce network trip
    No, use pure SQL
    6) Use EXTERNAL Table to build interface rather then creating custom table and program to Load and validate the data
    Makes no sense.
    7) Understand Oracle's Cost based Optimizer and Tune most expensive SQL queries with help of Explain plan
    What about using the execution trace?
    8) Follow Oracle PL/SQL Best Practices
    Which are?
    9) Review tables and their indexes being used in the SQL queries and avoid unnecessary Table scanning
    You mean design your database and queries properly?  And table scanning is not always bad.
    10) Avoid costly Full Table Scan on Big Transaction tables with Huge data volume,
    It depends if that is necessary or not.
    11) Use appropriate filtration condition on index columns of seeded Oracle tables directly mapped to program parameters
    No, consider that too many indexes can have an impact on overall performance and can prevent the CBO from picking the best plan.  There's far more to creating indexes than just picking every column that people are likely to search on; you have to consider the cardinality and selectivity of data, as well as the volumes of data being searched and the most common search requirements.
    12) Review Join condition on existing query explain plan
    Well, if you don't have your join conditions right then your query won't work, so that's obvious.
    13) Use Oracle hint to guide Oracle Cost based optimizer to choose best plan for your custom queries
    No.  Oracle recommends you do not use hints for query optimization (it says so in the documentation).  Only certain hints such as APPEND etc. which are more related to certain operations such as inserting data etc. are acceptable in general.  Oracle recommends you use the query optimization tools to help optimize your queries rather than use hints.
    14) Avoid applying SQL functions on index columns
    Why?  If there's a need for a function based index, then it should be used.
    15) Use appropriate hint to guide Oracle CBO to choose best plan to reduce response time
    See 13.
    In short, there are no silver bullets for dealing with performance.  Each situation is different and needs to be evaluated on its own merits.

  • SharePoint Foundation 2013 - March 2014 Update Issue - Need help

    We've just applied the SharePoint Foundation 2013 March 2014 Update, it always requires that we run the SharePoint Products Configuration Wizard at the end of install, but this time it's getting stuck at step 9 of 10 (the profile sync service cannot be
    started even as admin). Is anyone else having any issues with this update? Has anyone else applied it yet? Is anyone else planning to apply it?
    If anyone can help with advice on this I'd appreciate it.

    Hi,
    We can still access CA but sync will not start. Tried rebooting after the failed configuration and tried to run it again but it didn't work.
    4/2014 10:45:16  5  ERR            Exception: System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc
    that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException:
    No connection could be made because the target machine actively refused it 127.0.0.1:32843
       at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
       at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
       --- End of inner exception stack trace ---
       at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
       at System.Net.HttpWebRequest.GetRequestStream()
       at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
       --- End of inner exception stack trace ---
    Server stack trace:
       at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
       at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
       at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at Microsoft.IdentityModel.Protocols.WSTrust.IWSTrustContract.Issue(Message message)
       at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst, RequestSecurityTokenResponse& rstr)
       at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst)
       at Microsoft.SharePoint.SPSecurityContext.SecurityTokenForContext(Uri context, Boolean bearerToken, SecurityToken onBehalfOf, SecurityToken actAs, SecurityToken delegateTo, SPRequestSecurityTokenProperties properties)
       at Microsoft.SharePoint.SPSecurityContext.SecurityTokenForLegacyLoginContext(Uri context)
       at Microsoft.SharePoint.SPSite.InitUserToken(SPRequest request)
       at Microsoft.SharePoint.SPSite.SPSiteConstructor(SPFarm farm, Guid applicationId, Guid contentDatabaseId, Guid siteId, Guid siteSubscriptionId, SPUrlZone zone, Uri requestUri, String serverRelativeUrl, Boolean hostHeaderIsSiteName, SPUserToken
    userToken, Boolean appWebRequest, String appHostHeaderRedirectDomain, String appSiteDomainPrefix, String subscriptionName, String appSiteDomainId, Uri primaryUri)
       at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
       at Microsoft.Office.Project.Server.Upgrade.FullFarmDependentProjectDatabaseSequence.SPSiteExists(Guid siteId)
       at Microsoft.Office.Project.Server.Upgrade.ProjectDatabaseSequence.AddNextLevelObjects()
       at Microsoft.SharePoint.Upgrade.SPHierarchyManager.Grow(SPTree`1 root, Boolean bRecursing, SPDelegateManager delegateManager)
       at Microsoft.SharePoint.Upgrade.SPHierarchyManager.Grow(SPTree`1 root, SPDelegateManager delegateManager)
       at Microsoft.SharePoint.Upgrade.SPUpgradeSession.Upgrade(Object o, Boolean bRecurse)
       at Microsoft.SharePoint.Administration.SPPersistedUpgradableObject.Upgrade(Boolean recursively)
       at Microsoft.SharePoint.Administration.SPDatabase.Upgrade(Boolean recursively)
       at Microsoft.SharePoint.Upgrade.SPUpgradeSession.ReflexiveUpgrade(Object o, Boolean bRecurse)
       at Microsoft.SharePoint.Upgrade.SPUpgradeSession.Upgrade(Object o, Boolean bRecurse)
       at Microsoft.SharePoint.Administration.SPPersistedUpgradableObject.Upgrade(Boolean recursively)
       at Microsoft.SharePoint.Upgrade.SPUpgradeSession.ReflexiveUpgrade(Object o, Boolean bRecurse)
       at Microsoft.SharePoint.Upgrade.SPUpgradeSession.Upgrade(Object o, Boolean bRecurse)
       at Microsoft.SharePoint.PostSetupConfiguration.UpgradeTask.Run()
       at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()
    4/2014 10:45:16  5  ERR            An exception of type System.ServiceModel.EndpointNotFoundException was thrown.  Additional exception information: There was no endpoint listening at
    http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
    System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at //localhost:32843/SecurityTokenServiceApplication/securitytoken. that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException,
    if present, for more details. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:32843
       at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
       at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
       --- End of inner exception stack trace ---
       at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
       at System.Net.HttpWebRequest.GetRequestStream()
       at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
       --- End of inner exception stack trace ---
    Server stack trace:
       at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
       at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
       at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at Microsoft.IdentityModel.Protocols.WSTrust.IWSTrustContract.Issue(Message message)
       at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst, RequestSecurityTokenResponse& rstr)
       at Microsoft.IdentityModel.Protocols.WSTrust.WSTrustChannel.Issue(RequestSecurityToken rst)
       at Microsoft.SharePoint.SPSecurityContext.SecurityTokenForContext(Uri context, Boolean bearerToken, SecurityToken onBehalfOf, SecurityToken actAs, SecurityToken delegateTo, SPRequestSecurityTokenProperties properties)
       at Microsoft.SharePoint.SPSecurityContext.SecurityTokenForLegacyLoginContext(Uri context)
       at Microsoft.SharePoint.SPSite.InitUserToken(SPRequest request)
       at Microsoft.SharePoint.SPSite.SPSiteConstructor(SPFarm farm, Guid applicationId, Guid contentDatabaseId, Guid siteId, Guid siteSubscriptionId, SPUrlZone zone, Uri requestUri, String serverRelativeUrl, Boolean hostHeaderIsSiteName, SPUserToken
    userToken, Boolean appWebRequest, String appHostHeaderRedirectDomain, String appSiteDomainPrefix, String subscriptionName, String appSiteDomainId, Uri primaryUri)
       at Microsoft.SharePoint.SPSite..ctor(Guid id, SPFarm farm, SPUrlZone zone, SPUserToken userToken)
       at Microsoft.Office.Project.Server.Upgrade.FullFarmDependentProjectDatabaseSequence.SPSiteExists(Guid siteId)
       at Microsoft.Office.Project.Server.Upgrade.ProjectDatabaseSequence.AddNextLevelObjects()
       at Microsoft.SharePoint.Upgrade.SPHierarchyManager.Grow(SPTree`1 root, Boolean bRecursing, SPDelegateManager delegateManager)
       at Microsoft.SharePoint.Upgrade.SPHierarchyManager.Grow(SPTree`1 root, SPDelegateManager delegateManager)
       at Microsoft.SharePoint.Upgrade.SPUpgradeSession.Upgrade(Object o, Boolean bRecurse)
       at Microsoft.SharePoint.Administration.SPPersistedUpgradableObject.Upgrade(Boolean recursively)
       at Microsoft.SharePoint.Administration.SPDatabase.Upgrade(Boolean recursively)
       at Microsoft.SharePoint.Upgrade.SPUpgradeSession.ReflexiveUpgrade(Object o, Boolean bRecurse)
       at Microsoft.SharePoint.Upgrade.SPUpgradeSession.Upgrade(Object o, Boolean bRecurse)
       at Microsoft.SharePoint.Administration.SPPersistedUpgradableObject.Upgrade(Boolean recursively)
       at Microsoft.SharePoint.Upgrade.SPUpgradeSession.ReflexiveUpgrade(Object o, Boolean bRecurse)
       at Microsoft.SharePoint.Upgrade.SPUpgradeSession.Upgrade(Object o, Boolean bRecurse)
       at Microsoft.SharePoint.PostSetupConfiguration.UpgradeTask.Run()
       at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()
    4/2014 10:45:16  1  ERR          One or more configuration tasks has failed or some tasks were not run
    4/2014 10:45:16  1  INF          Leaving function TaskDriver.OnTaskDriverStopping
    04/14/2014 10:45:16  1  INF        Leaving function TaskDriver.ExecuteTasks
    04/14/2014 10:45:16  1  ERR        One or more configuration tasks has failed to execute
    4/2014 10:45:16  1  ERR          Configuration of SharePoint Products failed.  Configuration must be performed in order for this product to operate properly.  To diagnose the problem, review
    the extended error information located at D:\Logs\PSCDiagnostics_4_14_2014_10_44_8_154_1605984328.log, fix the problem, and run this configuration wizard again.
    04/14/2014 10:45:16  1  INF          Entering function StringResourceManager.GetResourceString
    4/2014 10:45:16  1  INF      Leaving function TaskDriver.Run
    04/14/2014 10:45:16  1  ERR      Post setup configuration was not run successfully when using the command line task driver module
    04/14/2014 10:45:16  1  INF    Leaving function PsconfigCommandLineMain.Main
    This is the meaty part of the errors we are getting. Right now our entire site is down. If you know of anything to remedy these errors let me know.

  • I am having problems rebooting my mid 2009 macbook pro (grey screen other issues), need help!

    I am having problems rebooting, I have experienced the same problem as others with the grey screen but my case is a little different, It started with my mid 2009 macbook pro acting a little slower than normal, the screen would freeze, mouse wouldnt move and i'd be forced to "force reboot" this went on for a couple of days until i was tinkering with the wifi connection and it froze again. I had to reboot and this time i noticed that it took a long time to get to the login screen. i put in my password and it went into infinite load (i also tried the guest account and other accounts with same result). i tried rebooting again and the same thing would happen. after several reboots, the screen just stayed grey, sometimes with the apple logo and gear sometimes without it. Since its a 2009, (and for the most part, still works like a champ) i decided test the ram, i took one stick of ram out at a time to see if i could notice anything wrong with them. when i stuck just one in, the mac was still having the same problem rebooting. i pulled that ram and and stuck in the other and i noticed that this time the apple logo never appeard and a big crossed out circle appeared. figuring that the ram must be the problem, i ordered new ram and installed it. i noticed that when i rebooted for the first time with the new ram it was rather quick and took me straight to the login screen and i was able to log in with no problem. at this point i thought the problem was solved, but i noticed the macbook still acting funny. at first, none of my files appeared on my desktop or in the finder window. after about 20 minutes, everything magically popped up. i also noticed long pauses/freezes with the colored pin wheel spinnig. i closed the laptop and opened it again and the screen just stayed black. i tried rebooting again, and again i got the grey screen with no signs of being able to log in... i waited about 20 minutes and tried to reboot again and again i was able to log in, however the macbook is still acting slow and will freeze with no signs of unfreezing without a reboot.
    my macbook is 5 years old and has plenty of miles on it, so i understand if the thing needs to be replaced alltogether but does anyone know what could be the issue? could the bad ram have corrupted the hard drive in anyway? would re-installing the OS fix it?? and if so, how would i do that if i downloaded mavericks from the app store? are there any other solutions to this problem?
    all my files and what not are backed up on an external HD so theres nothing on it that i'd miss desperately if i had to whipe the hard drive but id really like to get her working again without any whiping of the HD. if anyone can help me out, it'd be greatly appreciated

    It is very difficult to offer troubleshooting suggestions when the "os version" you are using is unknown as each os has their own troubleshooting solutions. 
    How large is your hard drive and how much hard drive space do you have left? 

Maybe you are looking for