Information générale
Forum:
Microsoft SQL Server
>I'm doing the book worm thing with getting the feel for SQL Server 7, and I've recently tackled the topic of Views. I'm seeing examples where the underlying SELECT statement has a WHERE clause, but I havent seen examples with a variable or parameterized WHERE clause (I see none of those little @ thingys, hmmmm....)
>
>So is it possible with a View in SQL Server to do what I'm used to doing in VFP with parameterized local views? Or am I way off base here? If I can not use a varable or parameter with a view, what would I do in SQL Server to get a result set based on a variable who's value is set at runtime? TIA!
Hi Rox,
Well, in Oracle it would be done like this:
CREATE OR REPLACE VIEW MyView (ParaVar IN SomeTable.Field1%TYPE)
IS
SELECT Field1, Field2
FROM SomeTable
WHERE Field1 = Paravar;
where paravar is the parameter you want to pass into the view. In SQL Server, I haven't the slightest idea. I just subscribed to the forum and am going to start working on my next Microsoft test. I decided on taking the SQL Server 7 test and the required architectures exam so I can finish my MCSD. Having gotten a handle on Oracle over the past year, I figured it would be the quickest and easiest to prepare for. I need to pony up the ten bucks Microsoft wants for a 120 version of SQL Server and get after it. There's only 3 messages on this form. Let's see if we can liven it up some.
Gregg
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement