|
Posted by Neil on 07/20/05 10:23
Hi, David.
Here's another one for you. I have an sp that takes various input parameters
for a customer, and processes the data using various case statements. I now
want to run this sp for all customers on a nightly basis. My immediate
reaction, as previously, would be to use a cursor to loop through all the
customers, get the input parameters for the sp from the Customer table, and
call the sp once for each customer. Is there a way to do this without a
cursor?
Thanks,
Neil
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@acm.org> wrote in message
news:1117710437.665131.255080@g47g2000cwa.googlegroups.com...
> Re-arranging order based on a column (pos):
>
> UPDATE foo
> SET pos = CASE pos
> WHEN @old_pos
> THEN @new_pos
> ELSE pos + SIGN(@old_pos - @new_pos)
> END
> WHERE pos BETWEEN @old_pos AND @new_pos
> OR pos BETWEEN @new_pos AND @old_pos
>
> Update different columns based on the length of a string value:
>
> UPDATE YourTable
> SET col1 =
> CASE
> WHEN LEN(x+y)<=10
> THEN a ELSE b END,
> col2 =
> CASE
> WHEN LEN(x+y)>10
> THEN a ELSE b END
> WHERE ...
>
> --
> David Portas
> SQL Server MVP
> --
>
>
>
>
>
>
> UPDATE
>
[Back to original message]
|