|
|
|
|
|
|
| Author |
Message |
sharona *nix forums beginner
Joined: 24 Jun 2005
Posts: 6
|
Posted: Mon Jun 26, 2006 12:44 pm Post subject:
How do I streamline this code?
|
|
|
Hi,
I have 3 blocks of code that are identical, can you tell me how to
rewrite this in a Sybase stored procedure so that I only have to write
the logic once?
SELECT @SourceRating = CASE
WHEN (@Source = "pr") THEN 3
WHEN (@Source = "qa") THEN 2
ELSE 1
END
SELECT @OwnerRating = CASE
WHEN (@AssetOwner = "pr") THEN 3
WHEN (@AssetOwner = "qa") THEN 2
ELSE 1
END
SELECT @StewardRating = CASE
WHEN (@Steward = "pr") THEN 3
WHEN (@Steward = "qa") THEN 2
ELSE 1
END
Thanks. |
|
| Back to top |
|
 |
Carl Kayser *nix forums beginner
Joined: 25 May 2005
Posts: 42
|
Posted: Mon Jun 26, 2006 1:18 pm Post subject:
Re: How do I streamline this code?
|
|
|
"sharona" <shari.arman@morganstanley.com> wrote in message
news:1151325874.375626.234160@p79g2000cwp.googlegroups.com...
| Quote: | Hi,
I have 3 blocks of code that are identical, can you tell me how to
rewrite this in a Sybase stored procedure so that I only have to write
the logic once?
SELECT @SourceRating = CASE
WHEN (@Source = "pr") THEN 3
WHEN (@Source = "qa") THEN 2
ELSE 1
END
SELECT @OwnerRating = CASE
WHEN (@AssetOwner = "pr") THEN 3
WHEN (@AssetOwner = "qa") THEN 2
ELSE 1
END
SELECT @StewardRating = CASE
WHEN (@Steward = "pr") THEN 3
WHEN (@Steward = "qa") THEN 2
ELSE 1
END
Thanks.
|
Well, they're not identical, but the point seems to be obvious.
SELECT @SourceRating = CASE
WHEN (@Source = "pr") THEN 3
WHEN (@Source = "qa") THEN 2
ELSE 1
END,
@OwnerRating = CASE
WHEN (@AssetOwner = "pr") THEN 3
WHEN (@AssetOwner = "qa") THEN 2
ELSE 1
END,
@StewardRating = CASE
WHEN (@Steward = "pr") THEN 3
WHEN (@Steward = "qa") THEN 2
ELSE 1
END |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Tue Dec 02, 2008 1:01 pm | All times are GMT
|
|
Personal Loans | Mobile Phones | Currency Converter | Loans | Mobile Phones
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|