Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parameterized SQL View
Message
De
29/04/2009 07:58:19
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2005
Application:
Desktop
Divers
Thread ID:
01396883
Message ID:
01396891
Vues:
53
How to do that?

>Make it into table-valued UDF.
>
>>
>>I have a view that calculates the Stock Balance upto current date. It is working for me.
>>
>>
>>SELECT     tmp.mcat_code, tmp.mat_code, Mat.mcat_desc, Mat.mat_desc, SUM(tmp.qty) AS qty
>>FROM         (SELECT     mcat_code, mat_code, SUM(qty) AS qty
>>                       FROM          mat_ob
>>                       GROUP BY mcat_code, mat_code
>>                       UNION
>>                       SELECT     mcat_code, mat_code, SUM(qty) AS qty
>>                       FROM         Purchase
>>                       GROUP BY mcat_code, mat_code
>>                       UNION
>>                       SELECT     mcat_code, mat_code, SUM((con_qty + wst_qty) * - 1) AS qty
>>                       FROM         Production
>>                       GROUP BY mcat_code, mat_code ) AS tmp INNER JOIN
>>                      Mat ON Mat.mcat_code + Mat.mat_code = tmp.mcat_code + tmp.mat_code
>>GROUP BY tmp.mcat_code, tmp.mat_code, Mat.mcat_desc, Mat.mat_desc
>>ORDER BY tmp.mcat_code, Mat.mat_desc
>>
>>
>>What i do if I want stock balance for certain date. Parameterized view? how to create it?
>>
>>Zahid
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform