List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:July 9 2003 2:47am
Subject:RE: concat() differences between mssql and mysql
View as plain text  
At 13:11 -0700 7/8/03, Daevid Vincent wrote:
>Hmmm. Well you might be able to work some magic if you know the length of
>the field it's supposed to be, then you could subtract the length of the
>Field and then pad with spaces.
>
>If this is to be displayed in a web page, and I assume you're trying to line
>things up pretty, just put them in table <TD> cells.
>
>If it's output to the terminal window, then try using a "\t" character to
>tab to the next spot for columnar output.

Another option, depending on the application, might be to use
RPAD(str,length-you-want,' ')

>
>
>Daevid Vincent
>http://daevid.com
>
>
>>  -----Original Message-----
>>  From: Ooks Server [mailto:OoksServer@stripped]
>>  Sent: Monday, July 07, 2003 4:38 PM
>>  To: mysql@stripped
>>  Subject: concat() differences between mssql and mysql
>>
>>
>>  I've run into a problem with the behavior of concat(). If I
>>  have two fields,
>>  char(10), and I do this:
>>
>>  concat(field1,fields)
>>
>>  With MSSQL I get both fields including trailing spaces. With
>>  MYSql, I get
>>  the two fields with the trailing spaces trimmed. Example:
>>
>>  Field1 = "abc       "
>>  Field2 = "qwerty    "
>>
>>  MSSQL -> concat( field1, fields) -> "abc       qwerty    "
>>  MYSQL -> concat( field1, fields) -> "abcqwerty"
>>
>>  How do I get Mysql to behave like MSSQL does? I need it to
>>  concatenate the
>  > fields without stripping the trailing spaces.


-- 
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified?  http://www.mysql.com/certification/

Thread
Trouble creating usersMichael Iatauro8 Jul
  • concat() differences between mssql and mysqlOoks Server8 Jul
    • Re: concat() differences between mssql and mysqlEgor Egorov8 Jul
      • RE: concat() differences between mssql and mysqlAndy Eastham8 Jul
    • RE: concat() differences between mssql and mysqlDaevid Vincent8 Jul
      • RE: concat() differences between mssql and mysqlPaul DuBois9 Jul
  • Re: Trouble creating usersNils Valentin8 Jul
  • Re: Trouble creating usersMichael Iatauro8 Jul
    • Re: Trouble creating usersNils Valentin8 Jul
  • Re: Trouble creating usersMichael Iatauro8 Jul
    • Re: Trouble creating usersNils Valentin9 Jul
    • Re: Trouble creating usersPaul DuBois9 Jul