Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
fazeran
Starting Member
4 Posts |
Posted - 2008-07-29 : 09:10:55
|
| I am trying to use data from another dataset and am receiving the following error:Invalid object name 'q_call_req_aging'. <-- That is another datasetHere is the original code (Access 2K):SELECT DISTINCTROW q_call_req_aging.Priority, Sum(q_call_req_aging.Hours) AS SumOfHours, Sum(IIf([Weeks]<=1,1,0)) AS [1 Week], Sum(IIf([Weeks]>1 And [Weeks]<=2,1,0)) AS [2 Weeks], Sum(IIf([Weeks]>2 And [Weeks]<=3,1,0)) AS [3 Weeks], Sum(IIf([Weeks]>3 And [Weeks]<=4,1,0)) AS [4 Weeks], Sum(IIf([Weeks]>4 And [Weeks]<=8,1,0)) AS [30 - 60 Days], Sum(IIf([Weeks]>8,1,0)) AS [Over 60 Days], Count(*) AS TotalFROM q_call_req_agingGROUP BY q_call_req_aging.Priority;Here is my 2K5 conversion attempt with the error:SELECT DISTINCT q_call_req_aging.Priority, SUM(q_call_req_aging.Hours) AS SumOfHours, SUM(CASE WHEN [Weeks] <= 1 THEN 1 ELSE 0 END) AS [1 Week], SUM(CASE WHEN [Weeks] > 1 AND [Weeks] <= 2 THEN 1 ELSE 0 END) AS [2 Weeks], SUM(CASE WHEN [Weeks] > 2 AND [Weeks] <= 3 THEN 1 ELSE 0 END) AS [3 Weeks], SUM(CASE WHEN [Weeks] > 3 AND [Weeks] <= 4 THEN 1 ELSE 0 END) AS [4 Weeks], SUM(CASE WHEN [Weeks] > 4 AND [Weeks] <= 8 THEN 1 ELSE 0 END) AS [30 - 60 Days], SUM(CASE WHEN [Weeks] > 8 THEN 1 ELSE 0 END) AS [Over 60 Days], COUNT(*) AS TotalFROM q_call_req_agingGROUP BY q_call_req_aging.PriorityAny info would be appreciated. I am very much a SQL newbie, so it could easily be an issue with another line of the code.Thanks,--Rich--Rich |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-29 : 09:17:18
|
what is the error message ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
fazeran
Starting Member
4 Posts |
Posted - 2008-07-29 : 09:23:58
|
| Error Message:Invalid object name 'q_call_req_aging'Thanks,--Rich |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-29 : 09:25:18
|
do you have such table or view in your database ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-29 : 09:26:10
|
create the q_call_req_aging as a view KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-29 : 10:18:06
|
quote: Originally posted by fazeran I am trying to use data from another dataset and am receiving the following error:Invalid object name 'q_call_req_aging'. <-- That is another datasetHere is the original code (Access 2K):SELECT DISTINCTROW q_call_req_aging.Priority, Sum(q_call_req_aging.Hours) AS SumOfHours, Sum(IIf([Weeks]<=1,1,0)) AS [1 Week], Sum(IIf([Weeks]>1 And [Weeks]<=2,1,0)) AS [2 Weeks], Sum(IIf([Weeks]>2 And [Weeks]<=3,1,0)) AS [3 Weeks], Sum(IIf([Weeks]>3 And [Weeks]<=4,1,0)) AS [4 Weeks], Sum(IIf([Weeks]>4 And [Weeks]<=8,1,0)) AS [30 - 60 Days], Sum(IIf([Weeks]>8,1,0)) AS [Over 60 Days], Count(*) AS TotalFROM q_call_req_agingGROUP BY q_call_req_aging.Priority;Here is my 2K5 conversion attempt with the error:SELECT DISTINCT q_call_req_aging.Priority, SUM(q_call_req_aging.Hours) AS SumOfHours, SUM(CASE WHEN [Weeks] <= 1 THEN 1 ELSE 0 END) AS [1 Week], SUM(CASE WHEN [Weeks] > 1 AND [Weeks] <= 2 THEN 1 ELSE 0 END) AS [2 Weeks], SUM(CASE WHEN [Weeks] > 2 AND [Weeks] <= 3 THEN 1 ELSE 0 END) AS [3 Weeks], SUM(CASE WHEN [Weeks] > 3 AND [Weeks] <= 4 THEN 1 ELSE 0 END) AS [4 Weeks], SUM(CASE WHEN [Weeks] > 4 AND [Weeks] <= 8 THEN 1 ELSE 0 END) AS [30 - 60 Days], SUM(CASE WHEN [Weeks] > 8 THEN 1 ELSE 0 END) AS [Over 60 Days], COUNT(*) AS TotalFROM q_call_req_agingGROUP BY q_call_req_aging.PriorityAny info would be appreciated. I am very much a SQL newbie, so it could easily be an issue with another line of the code.Thanks,--Rich--Rich
you cant use another dataset name like this. either replace the dataset name with actual query or put the result onto a temporary table and use it instead. |
 |
|
|
fazeran
Starting Member
4 Posts |
Posted - 2008-07-29 : 10:20:00
|
| I appreciate the help khtan. I am sure it would help to know that the 'q_call_req_aging' only exists as a dataset in my SRS at the moment. I am trying to reference it from the dataset above which is also on the same reports server and within the same SRS project. Originally these queries existed in an Access 2K report database I am trying to convert over to SRS. The Access 2K version continues to run without issue even though there is no View created for the 'q_call_req_aging' object on the SQL side. That being said, I know in SRS you are able to have multiple datasets, but are you able to reference output from one to another? I apologize for my knowledge level, or lack there of, but I am new to SQL and though my 3 day class was great it seems to have barely broke the surface.Thanks,--Rich |
 |
|
|
fazeran
Starting Member
4 Posts |
Posted - 2008-07-29 : 10:21:31
|
| Thank you visakh16. I will go that route!Thanks,--Rich |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-29 : 11:03:59
|
quote: Originally posted by fazeran I appreciate the help khtan. I am sure it would help to know that the 'q_call_req_aging' only exists as a dataset in my SRS at the moment. I am trying to reference it from the dataset above which is also on the same reports server and within the same SRS project. Originally these queries existed in an Access 2K report database I am trying to convert over to SRS. The Access 2K version continues to run without issue even though there is no View created for the 'q_call_req_aging' object on the SQL side. That being said, I know in SRS you are able to have multiple datasets, but are you able to reference output from one to another? I apologize for my knowledge level, or lack there of, but I am new to SQL and though my 3 day class was great it seems to have barely broke the surface.Thanks,--Rich
i dont think you can reference one of dataset fields inside other dataset. |
 |
|
|
|
|
|
|
|