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 |
|
zwheeler
Starting Member
25 Posts |
Posted - 2011-08-11 : 13:04:14
|
| HiIn oracle i could use the rpad or lpad functions to pad my variable,however, i do not believe these functions exsits in sql server. how can i do this.Actually, i need my output to be fixed lengthselect pjt_no, primary_street_addr, city,st, left( ' ' + cast( zip_code AS varchar(9))), 9 )fromopenquery(daps_linked, 'select * from app_property,a1_pipe_snapshot where application_id = dap_application_id ')where pipe_stat_grp in ('IP','O','FIN REJ','WDRN','EXP')Goso, for examplepjt_no ----50 charactersprimary_street_addr --- 100 charactersonce i see one example i can code the rest |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-08-11 : 13:20:32
|
| CAST the values as char with the correct length:SELECT CAST(pjt_no AS char(50)), cast(primary_street_addr as char(100)), ... FROM ... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-11 : 13:25:30
|
may be this?select pjt_no + SPACE(50),primary_street_addr,... ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
zwheeler
Starting Member
25 Posts |
Posted - 2011-08-11 : 14:07:21
|
| thanks robvolk |
 |
|
|
|
|
|
|
|