Display one character give number of times
I have a table like this:
I need to add a character "A" incremented number of times to the end of stor_Id if qty <=90开发者_如何学JAVA.
So after returning a query I should get Something like:
Stor_Id
7131
7066
7067a
8042aa
7896aaa
6380aaaa
Thanks!
Assuming Rank is also an incrementing number. If not then I'm not sure how to have a number increment for each row your operating on.
Something like this should work (not tested, but should be almost there)
UPDATE U
SET stor_Id = stor_Id + REPLICATE('A',rank)
FROM MyTable AS U
WHERE qty <= 90
精彩评论