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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Sub Queries in Stroed procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-29 : 09:20:50
Robin writes "I'm running a stored procedure which , along with other things, executes several sub queries during the course of it's execution. My question is, when I run the code below:
(Select Fee_Amount From Setup_Monthly_Fees (NOLOCK) Where Fee_Description In ('Delivery Fee') And Property_ID Like @PropID) As DelFee,

I get the value I'm looking for but I cannot access the alias further down the stored porocedure. Why can't I refer to 'DelFee' in a later part of the stored proc?

Question #2: Is the code below a legal way to check if a sub query returns nothing in SQL Server?

(Select Flat_Fee From Billing_Exceptions (NOLOCK) Where Billing_Exceptions.Property_ID Like @PropID And Billing_Exceptions.GDS_Code Like LTrim(Billing_Table.GDS_Code)) Is Null"
   

- Advertisement -