I have a table with 47 columns and 62580 rows and I am trying to run Microsoft Query to weed out some records. The SQL query I am running gives me a a message that says "Too few parameters. Expected 1" The query is as follows:
SELECT AllAccts.Account, AllAccts.BR, AllAccts.Block, AllAccts.Lot, AllAccts.NAME_CUST, AllAccts.CL, AllAccts.AT, AllAccts.PA_Default, AllAccts.HDFC, AllAccts.TC, AllAccts.CD, AllAccts.AR, AllAccts.LPC, AllAccts.UTIL, AllAccts.DELQ30, AllAccts.DELQ60, AllAccts.DELQ90, AllAccts.DELQ180, AllAccts.DELQ270, AllAccts.DELQ365, AllAccts.DELQ2YR, AllAccts.DELQ3YR, AllAccts.DELQ4YR, AllAccts.DELQ5YR, AllAccts.LAST_PAY_DATE, AllAccts.LAST_PAY_AMT, AllAccts.`SA Number`, AllAccts.`SA Street`, AllAccts.`SA Suffix`, AllAccts.SAZIP, AllAccts.MAILING_ADDR, AllAccts.MAILING_CITY, AllAccts.MAILI, AllAccts.ALERT_ADDR, AllAccts.ALERT_CITY, AllAccts.ALERT_ZIP, AllAccts.SERV_ADDR, AllAccts.SERV_CITY, AllAccts.SERV_STATE, AllAccts.SERV_ZIP, AllAccts.MAILING_ADDR1, AllAccts.MAILING_CITY1, AllAccts.MA, AllAccts.MAILI1, format(AllAccts.SERV_ADDR_PHONE,'@@@-@@@-@@@@') AS 'serv_phone', AllAccts.SERV_ADDR_PHONE, AllAccts.CUST_PHONE_, AllAccts.SPOUSE_P
FROM `Q:\RobsFolder\RHRecentDelq -- original accts summary`.AllAccts AllAccts
WHERE (AllAccts.DELQ30>=500 And AllAccts.DELQ30<=500000) AND (AllAccts.HDFC<>'20000') AND (AllAccts.SERV_ADDR_PHONE<>0) AND (AllAccts.CL Not Between 'T1' And 'Z9' And AllAccts.CL Not Between 'I1' And 'I9' And AllAccts.CL Not Between 'M1' And 'M9' And AllAccts.CL Not Between 'N1' And 'N9' And AllAccts.CL Not Between 'P1' And 'P9' And AllAccts.CL Not Between 'Q1' And 'Q9') AND (len(SERV_ADDR_PHONE)=10)
Could anyone give me some advice on debugging this SQL query? The strange thing is I ran it last week on a similar table and I did not have a problem. I'll be very thankful for any insight.
SELECT AllAccts.Account, AllAccts.BR, AllAccts.Block, AllAccts.Lot, AllAccts.NAME_CUST, AllAccts.CL, AllAccts.AT, AllAccts.PA_Default, AllAccts.HDFC, AllAccts.TC, AllAccts.CD, AllAccts.AR, AllAccts.LPC, AllAccts.UTIL, AllAccts.DELQ30, AllAccts.DELQ60, AllAccts.DELQ90, AllAccts.DELQ180, AllAccts.DELQ270, AllAccts.DELQ365, AllAccts.DELQ2YR, AllAccts.DELQ3YR, AllAccts.DELQ4YR, AllAccts.DELQ5YR, AllAccts.LAST_PAY_DATE, AllAccts.LAST_PAY_AMT, AllAccts.`SA Number`, AllAccts.`SA Street`, AllAccts.`SA Suffix`, AllAccts.SAZIP, AllAccts.MAILING_ADDR, AllAccts.MAILING_CITY, AllAccts.MAILI, AllAccts.ALERT_ADDR, AllAccts.ALERT_CITY, AllAccts.ALERT_ZIP, AllAccts.SERV_ADDR, AllAccts.SERV_CITY, AllAccts.SERV_STATE, AllAccts.SERV_ZIP, AllAccts.MAILING_ADDR1, AllAccts.MAILING_CITY1, AllAccts.MA, AllAccts.MAILI1, format(AllAccts.SERV_ADDR_PHONE,'@@@-@@@-@@@@') AS 'serv_phone', AllAccts.SERV_ADDR_PHONE, AllAccts.CUST_PHONE_, AllAccts.SPOUSE_P
FROM `Q:\RobsFolder\RHRecentDelq -- original accts summary`.AllAccts AllAccts
WHERE (AllAccts.DELQ30>=500 And AllAccts.DELQ30<=500000) AND (AllAccts.HDFC<>'20000') AND (AllAccts.SERV_ADDR_PHONE<>0) AND (AllAccts.CL Not Between 'T1' And 'Z9' And AllAccts.CL Not Between 'I1' And 'I9' And AllAccts.CL Not Between 'M1' And 'M9' And AllAccts.CL Not Between 'N1' And 'N9' And AllAccts.CL Not Between 'P1' And 'P9' And AllAccts.CL Not Between 'Q1' And 'Q9') AND (len(SERV_ADDR_PHONE)=10)
Could anyone give me some advice on debugging this SQL query? The strange thing is I ran it last week on a similar table and I did not have a problem. I'll be very thankful for any insight.