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 |
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-12-18 : 10:36:54
|
| Hi If I have a table set up by a sub query like [CODE]select a,b,c,CASE WHEN a in (select * from R)FROM (select code here...) R[/CODE]This gives me Invalid object name 'R'. but R is read if i just select R.code (or another fieldname)outside the CASE statement ?I have tried putting the inner SQL in the CASE but its a large query and i get a 'ran out of stack space error'...is there some restrictions on accessing sub qrys from CASES ? |
|
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2007-12-18 : 10:54:58
|
| its probablly giving you an error because of the Select * From inside the case statement, you may need to specify 1 column. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-18 : 10:55:04
|
You can't alias an outer table in an inner query to get same result. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-12-18 : 11:08:24
|
| yeah but when I try the select code , instead of select * it still doesn't work.. |
 |
|
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-12-18 : 11:08:54
|
quote: Originally posted by Peso You can't alias an outer table in an inner query to get same result. E 12°55'05.25"N 56°04'39.16"
Oh ? any other solution ? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2007-12-18 : 11:21:50
|
| Can you give more idea of what are trying to get as output? |
 |
|
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-12-18 : 11:29:45
|
| I need to select codes and based on these codes being a member of another subset of codes output a description.The inner query is done and it runs fine, but if i put it in the CASE its way to slow, so i want to just reference itas another table in the case instead. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2007-12-18 : 11:46:48
|
| Can you provide me a mock up of your data and table structures and expected o/p? |
 |
|
|
pazzy11
Posting Yak Master
145 Posts |
Posted - 2007-12-18 : 12:40:48
|
| Whats an external wrapper ? |
 |
|
|
|
|
|