Monday, March 26, 2012

Proper use of the Right Function

RIGHT(value, numberofchars)
select right(username, 6) from ...
Seems like a reference to Books Online would have done this for you much
more efficiently than a forum post. :-)
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net
"fiaola" <fiaola@.mail.com> wrote in message
news:O9fJ6tLVIHA.5448@.TK2MSFTNGP04.phx.gbl...
> Hi,
> I tried to use the right function as, "Select right(UserName) as UN from
> Table1" and it returned "blank".
> It works well with Left. Im puzzled.
> Thanks
>
"fiaola" <fiaola@.mail.com> wrote in message
news:uIiqWJuVIHA.1184@.TK2MSFTNGP04.phx.gbl...
> Thanks for the reply. I did that, but it returned blank values. If i
> tried the LEFT function, it works well.
> My field is a character, and I could not figure out why it does not pickup
> the parameters requested.
>
What is the username you're using?
Perhaps the 6 right most characters are blank?
Can you post the actual code.
Thanks.

> "TheSQLGuru" <kgboles@.earthlink.net> wrote in message
> news:13ogib06s428b79@.corp.supernews.com...
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html

No comments:

Post a Comment