--Right (' A ' +cast (' B ' as nvarchar ()), C)
Variable on the right
A
: The maximum length of the character to be replenished. For example: ' 0000 ' up to supplement
4
bit, insufficient
Bit with
0
"AAAA" total
4
bit, less bit with
A
Add.
B
:
Variable
C
: string length after supplement
Select ' CDMS ' +right (' 0000000 ' +cast (' 111 ' as nvarchar (50)), 7)
DWBH--
Results:
0000111
Select
' CDMS ' +right (' +cast ' (
' 111 ' AS
nvarchar (50)), 7)
DWBH--
Knot
Fruit:
000111
--Left (cast (' B ' as nvarchar ()) + ' AA ', C)
Variable on the left
A
:
The length of the complement character to be replenished. For example: ' 0000 ' is used for low-bit
0
Add
Most
Add
4
' AAAA ' for Less
A
Supplement, Up to supplement
4
-bit
B
:
Variable
C
: string length after supplement
Select ' CDMS ' +left (Cast (' 111 ' as nvarchar () + ' AA '), DWBH--
Results:
Cdms111aa
Insufficient number of Sql digits to supplement 0 or other characters