Create adricUnionSubQuery

Probably pre-historic way of doing this, but I had small # of students I need to insert records into a table with, and instead of punching in values one-by-one into insert DML statements, I wanted to format T-SQL to spit out insert statements for me.

a) First built queries using the student numbers and/or names from a PDF file sent by client
b) Added StudID & combined students first & last name into string as preliminary testing, using RTRIM to get rid of spaces
c) Ultimate goal was to combine the 20 queries into a statement that I could use in subquery [ie. where StudID in (...) ]

Once I verified the UNIONs worked, I proceeded:

d) Find StipendID using StudIDs
e) Find StipendSchedIDs using StipendIDs from StudIDs

Then, I combined it all into the final query, formatting when needed to make into one string

f) CAST, CONVERT (details concerning appropriate datatype length, and nuances between CAST & CONVERT not taken into account here)
g) CASE used specific with NULL values in studentppid, if not added it would NULL out the whole string I was trying to build