On 3?21?, ??8?05?, "Andrew J. Kelly" <sqlmvpnooos...@shadhawk.com>
wrote:
> The function will only operate on one row at a time. This is the big
> downside of a function such as this since it takes a set based operation and
> essentially turns it into a cursor so to speak. But for what you are doing
> that is what you want. You want update the column Mkt_Val to the return
> value of the function using the values for the other columns in the same
> row. The WHERE clause will simply limit which rows it acts on not what
> values it uses.
>
> --
> Andrew J. Kelly SQL MVP
>
> "DWalker" <n...@none.com> wrote in message
>
> news:OlGqf6zaHHA.4396@TK2MSFTNGP06.phx.gbl...
>
>
>
> >I have an Account table with fields SSN, Account_Number, and Market_Value,
> > in SQL 2000.
>
> > I populate SSN and Account_Number from some other source.
>
> > I have a scalar function called GetMarketValue that takes three
> > parameters:
> > SSN, Account Number, and Date, and returns Money.
>
> > Then I do this:
>
> > Update Account
> > Set Mkt_Val = dbo.GetMarketValue(SSN, Account_Number, '12/31/2006')
>
> > It works just like I would expect. Even with the absence of a WHERE
> > clause.
>
> > And there's no FROM clause either, I just realized, but the answers seem
> > to
> > be in the right records.
>
> > I don't see using this kind of scalar function using entire sets of input
> > parameters, actually documented anywhere in BOL.
>
> > Is there some implied JOIN or WHERE clause going on here, to put each of
> > the correct market values into the correct record with the corresponding
> > SSN and account number, or am I doing something wrong?
>
> > Thanks.
>
> > David Walker- ??????? -
>
> - ??????? -
I have some question about row based operation,as you have
say,function operation is one of this,
i think such code:
delcare @str varchar(1000)
select @str = @str + columnname +',' from table where cretiral
is also excute row by row :)
so my question is:
whether the set based operation is externally?