The default length for STR(<numeric>) is 10 Characters - right aligned padded with leading blanks.
Add one for the "/" and you'll default to 21 chars.

If you want a standard representation:

SELECT STRTRAN(str(nMonth, 2) + "/" + str(nYear, 4), " ", "0") AS monyear




Lew Schwartz wrote:

I have a table with 2 numeric cols, one for month, the other for year.
If I go to the top of the table where the month is 1 and create a cursor
of with a character column formatted mm/yyyy's with the statement

select alltrim(str(nMonth))+"/"+alltrim(str(nYear)) ....

I get a column that's 21 characters wide -- the width of the 2
underlying numeric columns, plus 1 for the /

I thought I would get a col 6 character wide  .... Ie
len(alltrim(str(nMonth))+"/"+alltrim(str(nYear)))

so what is it that I don't understand about trim() functions and column
types and widths?
...seems I should know this; don't all shout at once

-Lew


[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to