Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can not make query to work
Message
De
06/03/2003 23:04:34
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00762448
Message ID:
00762573
Vues:
13
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform