Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 3rd, 2004, 10:38 AM
rgiannone rgiannone is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 rgiannone User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > SPACE and REPLICATE help needed


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT