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 |
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2010-02-11 : 05:11:19
|
| Dear All,I need to write a select query in this format.If my input parameter is 44344 i need to select 443.4 553535 --> 553.5867621 -->867.6 etcHow to write a select query for this.Please help me Thanks,Gangadhar |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-11 : 05:21:09
|
| [code]SELECT LEFT(STUFF(yourcol,4,0,'.'),5) FROM Table[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2010-02-11 : 05:44:14
|
| Hi Visakh,Thanks for your immediate reply If the input is only 85 then i will get NULL i want the same if the count is lessthan 3. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-11 : 05:47:26
|
| so for 85 what should be your output?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-11 : 05:52:07
|
quote: Originally posted by gangadhara.ms Hi Visakh,Thanks for your immediate reply If the input is only 85 then i will get NULL i want the same if the count is lessthan 3.
Why do you want to do this?MadhivananFailing to plan is Planning to fail |
 |
|
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2010-02-11 : 06:18:50
|
| For 85 the output should be 85 itself I mean any value count lessthan 3 should be same as it is . |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-11 : 06:22:23
|
| SELECT LEFT(COALESCE(STUFF(yourcol,4,0,'.'),yourcol),5) FROM Table------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|