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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select right(('0000'+pageorder),3) from neworder

Status
Not open for further replies.

NSMan

Technical User
Aug 26, 2004
72
US
When the following is typed in, I get these results...

select right(('0000'+pageorder),3) from neworder

4
5
6
7
8
9
10
11
12
13
ect...

I know this is something stupid and dumb, but I'm too tired to figure it out....
 
Trim the field
Code:
select right(('0000'+rtrim(pageorder)),3) from door


Borislav Borissov
 
Could be......but then they would have to let us know what datatype pageorder is. If it's INT, then they are just ADDING the two numbers together and not concatenating them. 0000 + 4 = 4

If they want to concatenate the 0000 to the number, they need to convert pageorder (if it is an int) to VARCHAR.

But we can guess all we want....they know what they want and just need to let us know.

-SQLBill

Posting advice: FAQ481-4875
 
:)
Agree.
I just post a reply with all assumption I made about the type of the field

Borislav Borissov
 
It looks like you're problem is with the data types. Try this:

select right(('0000'+cast(pageorder as varchar(3))),3)
from neworder

This assumes pageorder won't be over 999.

Pat
 
you can just do cast(pageorder as varchar), rather than specifying 3 digits.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top