How to separate field partdone to text yes or no or null based on position ?
I work on SQL server 2012 and have table parts have two field
- partId int
- PartDone nvarchar(50)
-
-
- partId partDone
- 555444 0012
- 911877 0221
the length of partDone field is 4 numbers
I need to loop within partDone field
if 0 then no
if 1 then yes
if 2 then null
FinalResult
- partId partDone first second third four
- 555444 0012 no no yes null
- 911877 0221 no null null yes
this field partDone accept only 0 or 1 or 2
and I need to divide them to yes or no or null based on position of every number
What I have tried:
select partId,partDone from Parts