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 |
|
Billpl
Yak Posting Veteran
71 Posts |
Posted - 2004-06-03 : 13:32:20
|
The first 2 queries work (obviously) but the third will not accept [b.investID] as a parameter.Anyone know the reason? Can't pass a parameter through a query to a UDF that represents a Table? That doesn't sound right. Select (select Sum( a.lastprice ) from app_investItem a where b.investID = a.InvestID ) as total From App_position b Where b.portID = @PortID Select (select Sum( a.total ) from dbo.TestSharesTable1( 1000, @Count ) a ) as total From App_position b Where b.portID = @PortID Select (select Sum( a.total ) from dbo.TestSharesTable1( b.InvestID, @Count ) a ) as total From App_position b Where b.portID = @PortID-- Incorrect syntax near '.' --
|
|
|
mtomeo
Starting Member
30 Posts |
Posted - 2004-06-03 : 15:30:58
|
| Maybe it doesn't recognize the aliased table name?Select (select Sum( a.total ) from dbo.TestSharesTable1( App_position.InvestID, @Count ) a ) as totalFrom App_position bWhere b.portID = @PortID |
 |
|
|
Billpl
Yak Posting Veteran
71 Posts |
Posted - 2004-06-03 : 17:03:16
|
| Thanks, but I still get the same error. I'm thinking that there must be a restriction on this (doubt it's a bug), but what would be the premise? It's not like the UDF could alter the behavior of the query. |
 |
|
|
|
|
|