Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pnpsql
Posting Yak Master
246 Posts |
Posted - 2012-05-26 : 07:20:44
|
| SELECT CASEWHEN ID = '' THEN Isnull(Replace(DESCRIPTION, '', NULL), -999999999)WHEN ID IS NULL THEN Isnull(DESCRIPTION, -999999999)ELSE IDEND FROM ABC IS THIS QUERY CORRECT AND OPTIMIZED PLEASE HELP THE BETTER WAY IF THIS CAN BE DONE .challenge everything |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-05-26 : 08:41:14
|
quote: IS THIS QUERY CORRECT
you didn't explain what are you trying to achieve, we can't really comment on thatquote: AND OPTIMIZED
Did you post the full query ? If that is it, it is just a simple select statement. There is nothing much can be done to optimize it further. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
estaban
Starting Member
1 Post |
Posted - 2012-05-26 : 15:20:09
|
| SELECT CASEWHEN ID = '' THEN Isnull(Replace(DESCRIPTION, '', NULL), -999999999)WHEN ID IS NULL THEN Isnull(DESCRIPTION, -999999999)ELSE IDEND AS SOMETHINGFROM ABC Add bold words to your query and try again.Emre CELIK |
 |
|
|
pnpsql
Posting Yak Master
246 Posts |
Posted - 2012-05-27 : 23:52:53
|
| got it .. thanks estabanchallenge everything |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-05-30 : 03:34:01
|
| or simplySELECT ISNULL(NULLIF('',NULL),-999999999) AS SOMETHING FROM ABCMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|