I’d like to create a T-SQL script that iterates through all the values of a temporary table that I create and creates users and grants them access
Think of it like that
DECLARE @MyList TABLE (Value NVARCHAR(150))
INSERT INTO @MyList VALUES ('User0'), ('User1'), ('User2'), ('User3')
DECLARE @cnt INT = 0;
WHILE @cnt < COUNT(@MyList)
CREATE USER [@MyList[@cnt]] (I know that its not the case and thats what im looking for) FROM EXTERNAL PROVIDER;
GRANT XXXX to [@MyList[@cnt]]
SET @cnt = @cnt + 1
END
Is that even possible?
4