Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parameterized views ins SQL Server???
Message
De
23/05/2003 17:06:56
 
 
À
23/05/2003 13:35:57
Bruno Di Lalla
Bdl Computer Consulting
Greely, Ontario, Canada
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00792260
Message ID:
00792440
Vues:
26
I would expect that both a stored procedure and view would return the same rowset given the same constraints.

-Mike

>Hi Michael,
>
>I expected this would be your answer.
>
>I will then stick with Stored Procedures for the most part as it will minimize the number of rows I get back, which is specially important to me when transferring data over low bandwidth.
>
>Thanks for your reply!
>
>Bruno
>
>>SQL Server's views work differently. The easiest way to think of it is that SQL Server combines the query that makes up the view with your query to create a new query.
>>
>>Now it doesn't actually work this way but it makes my point. SQL Server views don't have to be parameterized. Using your examples:
>>
>>
>>CREATE TestView AS View ;
>>SELECT Client.Name ;
>>FROM Client ;
>>
>>
>>
>>SELECT * FROM TestView WHERE city='Ottawa'
>>
>>
>>In this way, views are used to simplfy the structure or hide values but you're not prevented from filtering out data.
>>
>>-Mike
>>
>>>Hello everyone,
>>>
>>>Using Visual Foxpro, I can create parameterized views such as:
>>>
>>>CREATE TestView AS View ;
>>>SELECT Client.Name ;
>>>FROM Client ;
>>>WHERE Client.City=?cCity
>>>
>>>In the above example, cCity is a variable. I can then initialize the variable:
>>>cCity="Ottawa"
>>>
>>>then Select the query
>>>
>>>SELECT * FROM TestView
>>>
>>>The ?cCity parameter will have been replaced by the variable's content "Ottawa" and I will obtain all the Client names who's city is Ottawa.
>>>
>>>Can something similar be done with Views in Microsoft SQL Server 2000 or is the only way to accomplish this is using a stored procedure?
>>>
>>>Thanks for your expertise,
>>>
>>>
>>>Bruno Di Lalla
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