sql server 2008 - SQL Query randomly stopped working? -


i have sql query provides information ssrs report. report stopped working today , i've checked query , not working either. cant see wrong query wont run. appreciated, need report online today, here error produced:

msg 8180, level 16, state 1, line 1 statement(s) not prepared. msg 207, level 16, state 1, line 1 invalid column name 'expr2522'. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1172.shortdescription" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1170.shortdescription" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1168.shortdescription" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.exam" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.pvhigh" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.pvach" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.pvcomp" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.pvcont" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.pvfund" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.pvxfr" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.pvstart" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.pg_difficultyordisabilityid" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.pg_ethnicityid" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.pg_sexid" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.expendyrnumber" not bound. msg 4104, level 16, state 1, line 1 multi-part identifier "tbl1166.lr_mysid" not bound. msg 207, level 16, state 1, line 1 invalid column name 'col5840'. msg 207, level 16, state 1, line 1 invalid column name 'col5843'. msg 207, level 16, state 1, line 1 invalid column name 'col5849'. 

here query:

with all_genders_lldds_ethns (select                                  gender,                                  lldd,                                  ethnicity,                                  pg_agebandid,                                  ageband,                                  agegroup                                                                    (select 'male' gender                                    union select 'female' gender) genders,                                  (select 'lldd' lldd                                    union select 'no_lldd' lldd) lldds,                                  (select 'wb' ethnicity                                   union select 'nwb' ethnicity) ethnicities,                                  (select distinct                                   pg_agebandid,                                   ab.description ageband,                                   ag.description agegroup                                                                      msql2.proachieve.dbo.lr_myshighbylevel l                                   left join msql2.progeneral.dbo.ageband ab on l.pg_agebandid = ab.agebandid                                   left join msql2.progeneral.dbo.agegroup ag on l.pg_agegroupid = ag.agegroupid                                                                      l.pg_qtype3id not in ('30','40') ,                                   l.lr_mysid in (select                                                     setting                                                                                                      msql2.proachieve.dbo.systemsetting                                                                                                      code='defaultlrsummary') ,                                    l.pg_expendyrid in ('11/12')) age_bands                                   ),     coreproachdata (select                         al.ageband,                         al.agegroup,                         lml.lr_mysid,                         al.gender,                         al.lldd,                         al.ethnicity,                         lml.ethnicitydetails,                         lml.lddetails,                         lml.disabilitydetails,                         '' details,                         al.pg_agebandid,                         lml.pg_expendyrid,                         lml.expendyrnumber,                         sum(lml.pvstart) pvstart,                         sum(lml.pvxfr) pvxfr,                         sum(lml.pvfund) pvfund,                         sum(lml.pvcont) pvcont,                         sum(lml.pvcomp) pvcomp,                         sum(lml.pvach) pvach,                         sum(lml.pvhigh) pvhigh,                         sum(lml.exam) exam                                                  all_genders_lldds_ethns al                         left join (select                                    case when l.pg_agegroupid = '1' '16-18' else '19+' end agegroup,                                      case when l.pg_sexid = 'm' 'male' else 'female' end gender,                                    case when l.pg_ethnicityid in ('23','31') 'wb' else 'nwb' end ethnicity,                                    case when l.pg_difficultyordisabilityid in ('1') 'lldd' else 'no_lldd' end lldd,                                    e.shortdescription ethnicitydetails,                                    ld.shortdescription lddetails,                                    d.shortdescription disabilitydetails,                                    l.*                                                                        msql2.proachieve.dbo.lr_myshighbylevel l                                    inner join msql2.progeneral.dbo.ethnicity e on e.ethnicityid = l.pg_ethnicityid                                    inner join msql2.progeneral.dbo.learningdifficulty ld on ld.learningdifficultyid = l.pg_learningdifficultyid                                    inner join msql2.progeneral.dbo.disability d on d.disabilityid = l.pg_disabilityid                                                                        l.pg_qtype3id not in ('30','40') ,                                    l.lr_mysid in (select                                                    setting                                                                                                      msql2.proachieve.dbo.systemsetting                                                                                                      code='defaultlrsummary') ,                                     l.pg_expendyrid in ('11/12')                                    )lml on al.gender = lml.gender ,                                            al.lldd = lml.lldd ,                                            al.ethnicity = lml.ethnicity ,                                            al.pg_agebandid = lml.pg_agebandid                           group                         al.ageband,                         al.agegroup,                         lml.lr_mysid,                         al.gender,                         al.lldd,                         al.ethnicity,                         lml.ethnicitydetails,                         lml.lddetails,                         lml.disabilitydetails,                         al.pg_agebandid,                         lml.pg_expendyrid,                         lml.expendyrnumber)  select * ( select --ageband, --pg_agebandid, agegroup, 'gender' stat_type, gender grouping_val, '' details, sum(isnull(pvstart,0)) starts, sum(isnull(pvxfr,0)) transfers, sum(isnull(pvfund,0)) lsc_funded, sum(isnull(pvcont,0)) continuing, sum(isnull(pvcomp,0)) completed, sum(isnull(pvach,0)) achieved, sum(isnull(pvhigh,0)) highgrades, sum(isnull(exam,0)) exam_taken_not_know, reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvstart,0))) 'success rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvcomp,0)) + sum(isnull(pvcont,0)) , sum(pvstart)) 'retention rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvcomp,0))) 'achievment rate'  coreproachdata  group --ageband, --pg_agebandid, agegroup, gender  union select --ageband, --pg_agebandid, agegroup, 'lldd break down' stat_type, 'learning difficulty'  grouping_val, lddetails details,  sum(isnull(pvstart,0)) starts, sum(isnull(pvxfr,0)) transfers, sum(isnull(pvfund,0)) lsc_funded, sum(isnull(pvcont,0)) continuing, sum(isnull(pvcomp,0)) completed, sum(isnull(pvach,0)) achieved, sum(isnull(pvhigh,0)) highgrades, sum(isnull(exam,0)) exam_taken_not_know, reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvstart,0))) 'success rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvcomp,0)) + sum(isnull(pvcont,0)) , sum(pvstart)) 'retention rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvcomp,0))) 'achievment rate'  coreproachdata  lddetails != 'none' , lddetails != 'not known/not provided'  group --ageband, --pg_agebandid, agegroup, lddetails  union select --ageband, --pg_agebandid, agegroup, 'lldd break down' stat_type, 'no learning difficulty'  grouping_val, lddetails details,  sum(isnull(pvstart,0)) starts, sum(isnull(pvxfr,0)) transfers, sum(isnull(pvfund,0)) lsc_funded, sum(isnull(pvcont,0)) continuing, sum(isnull(pvcomp,0)) completed, sum(isnull(pvach,0)) achieved, sum(isnull(pvhigh,0)) highgrades, sum(isnull(exam,0)) exam_taken_not_know, reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvstart,0))) 'success rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvcomp,0)) + sum(isnull(pvcont,0)) , sum(pvstart)) 'retention rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvcomp,0))) 'achievment rate'  coreproachdata  lddetails = 'none'  group --ageband, --pg_agebandid, agegroup, lddetails  union select --ageband, --pg_agebandid, agegroup, 'lldd break down' stat_type, 'unknown'  grouping_val, lddetails details,  sum(isnull(pvstart,0)) starts, sum(isnull(pvxfr,0)) transfers, sum(isnull(pvfund,0)) lsc_funded, sum(isnull(pvcont,0)) continuing, sum(isnull(pvcomp,0)) completed, sum(isnull(pvach,0)) achieved, sum(isnull(pvhigh,0)) highgrades, sum(isnull(exam,0)) exam_taken_not_know, reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvstart,0))) 'success rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvcomp,0)) + sum(isnull(pvcont,0)) , sum(pvstart)) 'retention rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvcomp,0))) 'achievment rate'  coreproachdata  lddetails = 'not known/not provided'  group --ageband, --pg_agebandid, agegroup, lddetails  union select --ageband, --pg_agebandid, agegroup, 'lldd break down' stat_type, 'disability'  grouping_val, disabilitydetails details,  sum(isnull(pvstart,0)) starts, sum(isnull(pvxfr,0)) transfers, sum(isnull(pvfund,0)) lsc_funded, sum(isnull(pvcont,0)) continuing, sum(isnull(pvcomp,0)) completed, sum(isnull(pvach,0)) achieved, sum(isnull(pvhigh,0)) highgrades, sum(isnull(exam,0)) exam_taken_not_know, reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvstart,0))) 'success rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvcomp,0)) + sum(isnull(pvcont,0)) , sum(pvstart)) 'retention rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvcomp,0))) 'achievment rate'  coreproachdata  disabilitydetails != 'no disability' , disabilitydetails != 'not known/not provided'  group --ageband, --pg_agebandid, agegroup, disabilitydetails  union select --ageband, --pg_agebandid, agegroup, 'lldd break down' stat_type, 'no disability'  grouping_val, disabilitydetails details,  sum(isnull(pvstart,0)) starts, sum(isnull(pvxfr,0)) transfers, sum(isnull(pvfund,0)) lsc_funded, sum(isnull(pvcont,0)) continuing, sum(isnull(pvcomp,0)) completed, sum(isnull(pvach,0)) achieved, sum(isnull(pvhigh,0)) highgrades, sum(isnull(exam,0)) exam_taken_not_know, reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvstart,0))) 'success rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvcomp,0)) + sum(isnull(pvcont,0)) , sum(pvstart)) 'retention rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvcomp,0))) 'achievment rate'  coreproachdata  disabilitydetails = 'no disability'  group --ageband, --pg_agebandid, agegroup, disabilitydetails  union select --ageband, --pg_agebandid, agegroup, 'lldd break down' stat_type, 'unknown' grouping_val, disabilitydetails details,  sum(isnull(pvstart,0)) starts, sum(isnull(pvxfr,0)) transfers, sum(isnull(pvfund,0)) lsc_funded, sum(isnull(pvcont,0)) continuing, sum(isnull(pvcomp,0)) completed, sum(isnull(pvach,0)) achieved, sum(isnull(pvhigh,0)) highgrades, sum(isnull(exam,0)) exam_taken_not_know, reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvstart,0))) 'success rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvcomp,0)) + sum(isnull(pvcont,0)) , sum(pvstart)) 'retention rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvcomp,0))) 'achievment rate'  coreproachdata  disabilitydetails = 'not known/not provided'  group --ageband, --pg_agebandid, agegroup, disabilitydetails  union select --ageband, --pg_agebandid, agegroup, 'lldd' stat_type, case when lldd ='no_lldd' 'no ' else '' end + 'learning disability / difficulty'  grouping_val, '' details, sum(isnull(pvstart,0)) starts, sum(isnull(pvxfr,0)) transfers, sum(isnull(pvfund,0)) lsc_funded, sum(isnull(pvcont,0)) continuing, sum(isnull(pvcomp,0)) completed, sum(isnull(pvach,0)) achieved, sum(isnull(pvhigh,0)) highgrades, sum(isnull(exam,0)) exam_taken_not_know, reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvstart,0))) 'success rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvcomp,0)) + sum(isnull(pvcont,0)) , sum(pvstart)) 'retention rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvcomp,0))) 'achievment rate'  coreproachdata  group --ageband, --pg_agebandid, agegroup, lldd  union select --ageband, --pg_agebandid, agegroup, 'ethnicity' stat_type, case when ethnicity ='nwb' 'non ' else '' end + 'white british' grouping_val, ethnicitydetails details, sum(isnull(pvstart,0)) starts, sum(isnull(pvxfr,0)) transfers, sum(isnull(pvfund,0)) lsc_funded, sum(isnull(pvcont,0)) continuing, sum(isnull(pvcomp,0)) completed, sum(isnull(pvach,0)) achieved, sum(isnull(pvhigh,0)) highgrades, sum(isnull(exam,0)) exam_taken_not_know, reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvstart,0))) 'success rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvcomp,0)) + sum(isnull(pvcont,0)) , sum(pvstart)) 'retention rate', reportingframework.dbo.fscis_calculatepercentages(sum(isnull(pvach,0)) , sum(isnull(pvcomp,0))) 'achievment rate'  coreproachdata  group --ageband, --pg_agebandid, agegroup, ethnicity, ethnicitydetails) sub  order --convert(int,pg_agebandid), stat_type, grouping_val 

this bit of speculation, long comment. when getting long streams of error messages helpful @ first one:

msg 8180, level 16, state 1, line 1 statement(s) not prepared. msg 207, level 16, state 1, line 1 invalid column name 'expr2522'. 

hmmm, curious, because there no column called expr2522 in query. looks sql compiler include in execution plan.

my suspicion changed in database. advice recompile queries, stored procedures, functions, , views. recompiling either fail , give more intelligible error message. or, might adjust queries , views new database structure work.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -