Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have executed this following query for multiple batches in sql 2005, I am getting error as "Too many table names in the query. Maximum allowable is 256". but in sql 2008 I am getting the perfect output. Any solution for this problem?

Here is my query follows

SQL
SELECT DISTINCT c.FacName as Faculty_Name,(SELECT top 1 CAST(AVG(CAST(b.FacQ1 AS DECIMAL(10, 2))) / 5 * 100 AS decimal(10, 2)) from Tb_Presea_Feedback as a, Tb_Presea_Faculty_Feedback as b, Tb_Presea_Faculty_Master as c1 where a.Entereddate BETWEEN '10/27/2014 12:00:00 AM' AND '12/20/2014 12:00:00 AM' and a.FeedbackId=b.FeedbackId and c1.Facid=c.Facid and c1.Facid=b.FacId and c1.Active='A' and a.Batchid='B10665') as FacQ1, (Select top 1 CAST(AVG(CAST(b.FacQ2 AS DECIMAL(10, 2)))  / 5 * 100 AS decimal(10, 2)) from Tb_Presea_Feedback as a, Tb_Presea_Faculty_Feedback as b, Tb_Presea_Faculty_Master as c1 where a.Entereddate BETWEEN '10/27/2014 12:00:00 AM' AND '12/20/2014 12:00:00 AM' and a.FeedbackId=b.FeedbackId and c1.Facid=c.Facid and c1.Facid=b.FacId and c1.Active='A' and a.Batchid='B10665') AS FacQ2, (Select top 1 CAST(AVG(CAST(b.FacQ3 AS DECIMAL(10, 2))) / 5 * 100 AS decimal(10, 2)) from Tb_Presea_Feedback as a, Tb_Presea_Faculty_Feedback as b, Tb_Presea_Faculty_Master as c1 where a.Entereddate BETWEEN '10/27/2014 12:00:00 AM' AND '12/20/2014 12:00:00 AM' and a.FeedbackId=b.FeedbackId and c1.Facid=c.Facid and c1.Facid=b.FacId and c1.Active='A' and a.Batchid='B10665') AS FacQ3,


Thanks
Sudha
Posted
Updated 19-Dec-14 20:18pm
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900