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 |
|
rgiannone
Starting Member
3 Posts |
Posted - 2004-02-03 : 11:29:24
|
| Hello,I am building a bill of material where based on the level each part is in the bill of material I want to add a number of leading spaces to the output. I can't seem to be able to add the number of spaces as the output comes out without the leading spaces. The REPLICATE function works with the hypen but not the space. HELP!!!SELECT REPLICATE("-",(levelNo-1)*5) + customer_numberFROM #tree, pd_parts_master WHERE #tree.id = pd_parts_master.entry_idORDER BY part_sequenceThe above code produces this:A 251 620 01 87-----A 251 620 01 86----------A 251 610 01 76----------A 251 610 02 76----------A 251 610 04 10 -----A 251 625 01 86-----A 251 626 40 16Changing to SELECT REPLICATE(" ",(levelNo-1)*5) + customer_number produces this:A 251 620 01 87A 251 620 01 86A 251 610 01 76A 251 610 02 76A 251 610 04 10 A 251 625 01 86A 251 626 40 16Changing to SELECT SPACE((levelNo-1)*5) + customer_number produces this:A 251 620 01 87A 251 620 01 86A 251 610 01 76A 251 610 02 76A 251 610 04 10 A 251 625 01 86A 251 626 40 16Thank you very much for your assistance.Robert Giannone |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-02-03 : 11:54:25
|
| I suspect this is due to where you are displaying it.It's the same code that I use herehttp://www.nigelrivett.net/RetrieveTreeHierarchy.htmlTry changing the font to courier.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|