I have a VB.NET service application that gets a list of email addresses based and a T-SQL command.
Using the .NET application, I then loop through each email address passing it as a parameter to an SQL stored procedure that does something based on the email address parameter I pass in.
I created the .NET service application so I could loop through emails and have it run at a specific time. I have learned since, that I can probably just do this in SQL only.
I would like to eliminate the .NET application. I would like to just do everything in one SPROC and then schedule a job to run and execute the SPROC.
Question I have is, can I assign a variable datatype (like an array in VB.NET) and then loop through each variable (for each)? What T-SQL can I use?