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 |
|
edusqluser
Starting Member
15 Posts |
Posted - 2009-09-02 : 18:19:46
|
| I am trying to generate a query to pull the data from a field and limit the characters to 35. If less than 35 fill the remainder to the Right with blanks totally 35.Anyone have a function for this?THX, EDUSQLUSER |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-09-02 : 18:24:13
|
| select left(<column> + replicate(' ', 35), 35) from <yourTable>EDIT:this should do it too:select convert(char(35), <column>) from <yourTable>Be One with the OptimizerTG |
 |
|
|
edusqluser
Starting Member
15 Posts |
Posted - 2009-09-02 : 18:34:07
|
| Thanks. I think I am missing something...This is what I haveLEFT(o.JobName + REPLICATE('',35),35) AS [JOB NAME] FROM Orders.o--------------------------------------------------Iam not getting the blanks?THX, EDUSQLUSER |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-09-02 : 18:37:48
|
| It looks like you have an empty string '' instead of a space ' 'Be One with the OptimizerTG |
 |
|
|
edusqluser
Starting Member
15 Posts |
Posted - 2009-09-02 : 18:40:25
|
| Thanks. You 2nd suggestion worked...I appreciate it!THX, EDUSQLUSER |
 |
|
|
|
|
|