|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SPACE and REPLICATE help needed
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_number FROM #tree, pd_parts_master WHERE #tree.id = pd_parts_master.entry_id ORDER BY part_sequence The 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 16 Changing to SELECT REPLICATE(" ",(levelNo-1)*5) + customer_number 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 16 Changing to SELECT SPACE((levelNo-1)*5) + customer_number 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 16 Thank you very much for your assistance. Robert Giannone |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > SPACE and REPLICATE help needed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|