I have query which returns user name, user zip code and 20+ other fields based on their IDs. For every data type returned, i cannot display the name as it gets redundant. I am trying to find a way to assign a global alphabet to every record returned. For instance; for student ID 1, i need to assign 'A', for student ID 223, i need to assign 'B', so on and so forth.
Here's a sample query:
select STUFF((SELECT', '+CAST(name AS VARCHAR)+', '+CAST(dob AS VARCHAR)from dbo.students FOR XML PATH('')),1,1,'')
I am hoping to get A) Chris,05/15/1985 B) Jeff,06/12/1982 C) Jordan, 09/04/1986