eggwhites
eggwhites

Reputation: 85

specify number of digits returned

I have a quantity that I want displayed as a whole number so I am using the below statement.

concat(CAST(oe_pick_ticket_detail.unit_quantity AS DECIMAL(10,0))

Right now it is returning 400

I'd like it to be an 8 digit number like this 00000400

How should I modify this?

Upvotes: 0

Views: 154

Answers (1)

John Cappelletti
John Cappelletti

Reputation: 81970

If SQL Server 2012+

Select Format(oe_pick_ticket_detail.unit_quantity,'00000000')           -- Returns 00000400

Another non-format option

Select right(concat('00000000',oe_pick_ticket_detail.unit_quantity),8)  -- Returns 00000400

Upvotes: 2

Related Questions