Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Length of Return String from Function

Status
Not open for further replies.

Baesucks

Programmer
Mar 10, 2008
37
US
I wrote a SQL function (my first) that returns a string (which can vary in length). If I declare the function like this...

ALTER Function getVteResolvedStatus (@VTE_ID INT) Returns varchar (30) AS

I always seem to get 30 characters back. If the string is only 20 characters I only want 20. I tried using RTRIM but that did not seem to work. Is there something I can do to make the return string truncate spaces?
 
Try using LTRIM & RTRIM together. You only truncate trailing spaces with RTRIM.

"Don't be irreplaceable. If you can't be replaced, you can't be promoted."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top