Schleid Alex

Schleid Alex

  • NA
  • 361
  • 48.2k

Help with while loop in sql server

Oct 22 2020 7:28 AM
I have this query
 
Declare @Fnum nchar(5)
 
While (len(@Fnum)<5
Begin
 Set @Fnum += '0
End
 Print @Fnum
 
I am expecting 0000 as result
 
 But this is not happening, I only have 0 as result?
 
Can I have some help please?
 

Answers (7)