I have a while loope in my query that get a string value in each loop. I want to store these strings in a queue and then access them when the loops ends in a reverse order, first-in-last-out. How can I do this in SQL? Also, can I code T-SQL in query or does it have to be a stored procedure? Thanks.