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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Add spaces after data to fill length

Author  Topic 

hueby
Posting Yak Master

127 Posts

Posted - 2006-03-17 : 10:40:02
Hey all,

I have a column of data that is 15 length. Data in this column usually ranges from 6-9 characters long. I'm working on a query to go through the data and add blank spaces after the data to fill it to 15 length.

So far, I'm playing with this code but not sure if I'm going in the right direction?

UPDATE IM_ITEM_MASTER_MC
SET IM_ITEM_MASTER_MC.item_code = left(item_code,15 + REPLICATE(' ',15))

nr
SQLTeam MVY

12543 Posts

Posted - 2006-03-17 : 10:49:59
close
item_code = left(item_code + REPLICATE(' ',15), 15)


==========================================
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.
Go to Top of Page

hueby
Posting Yak Master

127 Posts

Posted - 2006-03-17 : 11:36:10
Ahh! Got it! Thank you!
Go to Top of Page
   

- Advertisement -