sql server - T-SQL: Looping through an array of known values -
This is my scenario:
Assume that I have a stored procedure in which to store another Process on a set of specific IDs required; Is there a way to do this?
i.e. Instead of doing so:
exec p_MyInnerProcedure 4 exec p_MyInnerProcedure 7 exec p_MyInnerProcedure 12 exec p_MyInnerProcedure 22 exec p_MyInnerProcedure 19
do something like this:
* Magic where I specify in my list 4,7,12,22,19 * selected magic cursor for FAST_FORWARD * Select Magic * Open MacCars Fetch from MyMaster @MyId WHILE @@ FETCH_STATUS = 0 My main focus here is my main goal here mainly maintenance (add / add attachment to change business Easy to list), as well as being able to list everyone at BEGIN exec p_MyInnerProcedure @MyId FETCH
ID is on a single line next to my console ... Display Should not be bigger as a problem
declare @ id table (IDX int identity (1,1), id int) Insert DIDS 4 Select Union 7 Select Union 12 Select Union 22 Select Union 19 Announce Ii int declare @cnt int select @i = minutes (IDA S) - 1, @ cnt = max (idx) @ id while @ e & lt; Select @TCNt @ i = @ e + 1 declare @ID = ID select ID where idx = @ iaaappimiento processor @ id and
Comments
Post a Comment