Re: len() malfunction?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 07/16/04


Date: Fri, 16 Jul 2004 10:39:33 -0400

What objects have trailing spaces? I can't reproduce your problem on my
system, using:

SELECT
 name,
 rtrim(name),
 len(name),
 datalength(name),
 len(rtrim(name)),
 datalength(rtrim(name)),
 len(left(name, 10)),
 datalength(left(name, 10)),
 len(left(name, len(rtrim(name)))),
 datalength(left(name, len(rtrim(name))))
FROM sysobjects

Any reason you're not just doing SELECT RTRIM(name)? Have you considered
converting the name to varchar (assuming you don't have any foreign
alphabets / unicode in your object names)? What about letting your
presentation tool deal with trailing spaces? What about using
INFORMATION_SCHEMA.ROUTINES instead of sysobjects?

-- 
http://www.aspfaq.com/
(Reverse address to reply.)
"Richard Ding" <rding@acadian-asset.com> wrote in message
news:uwu8FD0aEHA.4032@TK2MSFTNGP11.phx.gbl...
> I'm getting a returned column set with width of 128 characters even though
> the longest name of all the stored procedures is only 44 characters. I'm
> expecting the left() function would truncate certain xxx number of
> characters from the right as specified in left(name, xxx). In my code, the
> width of the name column returned should be 44 character long.


Relevant Pages

  • Re: Visual basic 6 ado error 3662 "operation was canceled"
    ... created as nchar with a fixed length of 50 characters so seem to be padded ... characters which SQL server thought was going to take the field over its max ... > tabs and or trailing spaces from somewhere) then i can change it no problem. ... > unless you replace the whole field by selecting and overtyping it. ...
    (microsoft.public.data.ado)
  • Re: Inspect...
    ... > encounter two spaces (and some other characters). ... > between Mike and Daniel) but 'MIKE DANIEL ' is not. ... > trailing spaces. ... NAME.ZIP from my website below under "COBOL Source Files." ...
    (comp.lang.cobol)
  • Re: Read command and trailing spaces
    ... > I have a script that reads a whole text file as follows: ... > (processing ROW) ... > The ROW is a fixed-length row of 913 characters. ... > contain all the 913 characters, trailing spaces included? ...
    (comp.unix.shell)
  • Re: building a text string with null fields
    ... Trailing spaces ... characters. ... have the ten positions added to the string. ... would some kind of format command with '@@@@@@@@@@' work to make sure the ...
    (microsoft.public.access.modulesdaovba)
  • RE: Combo Box Question with Spaces
    ... This will include leading and embedded spaces, ... If you need to have trailing spaces displayed, ... "Markus" wrote: ... > always the same so where there is no characters it must give me a blank space ...
    (microsoft.public.access.forms)