Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can not make query to work
Message
From
06/03/2003 23:04:34
 
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00762448
Message ID:
00762573
Views:
15
Why are you using Dynamic SQL?
select 
 CredID
 , State
 , Address
from 
 Credit..CreditInfo 
where 
 CredID in (
  select CredID 
  from 
   CartDetail 
   inner Join CartContent 
    on CartDetail.CartContentID = CartContent.CartContentID 
  WHERE
   and CartContent.CartID = @tnCartID
   and CartContent.CreditCategory = @Category
>Also how can I reference result of select within procedure, e.g.
>select ...

This is harder. The first question is: do you really need to? Could you use derive tables or views to remove the need for creates a bunch of result sets that later get combined. If not, you have your choice of temporary tables or table variables with table variables being the perferred choice, as long as your running at least SQL Server 2000.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform