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 |
|
Mir
Starting Member
19 Posts |
Posted - 2009-11-18 : 00:13:30
|
| Hi guys,How can I change0.00 to 2.00into 0.00 to 1.001.00 to 2.00I try using case function but got stuck.Anyone please help ?Thanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-11-18 : 00:25:22
|
always increment by 1 ?cross join to a number table. use F_TABLE_NUMBER_RANGE if you don't have oneselect NUMBER, NUMBER + 1from F_TABLE_NUMBER_RANGE(0, 2) KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Mir
Starting Member
19 Posts |
Posted - 2009-11-18 : 00:37:58
|
Thanks for your reply KHTAN,The original data isFROM TO0.00 - 2.002.00 - 3.00I want the output to beFROM TO0.00 - 1.001.00 - 2.002.00 - 3.00Thanks..quote: Originally posted by khtan always increment by 1 ?cross join to a number table. use F_TABLE_NUMBER_RANGE if you don't have oneselect NUMBER, NUMBER + 1from F_TABLE_NUMBER_RANGE(0, 2) KH[spoiler]Time is always against us[/spoiler]
|
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-11-18 : 02:31:10
|
[code]select NUMBER, NUMBER + 1from yourtable s cross apply F_TABLE_NUMBER_RANGE(st, en - 1)order by NUMBER[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Mir
Starting Member
19 Posts |
Posted - 2009-11-18 : 03:40:33
|
Thanks for ur reply khtan.what is st and en?How can i apply column from and to from mytable to this query?quote: Originally posted by khtan
select NUMBER, NUMBER + 1from yourtable s cross apply F_TABLE_NUMBER_RANGE(st, en - 1)order by NUMBER KH[spoiler]Time is always against us[/spoiler]
|
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-11-18 : 04:30:42
|
st is the FROMen is the TOof yourtable KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|
|