Question: Write a script in SQL that creates four login IDs based on the contents of a new table called NewLogins. CREATE TABLE NewLogins (LoginName varchar(128))
Write a script in SQL that creates four login IDs based on the contents of a new table called NewLogins.
CREATE TABLE NewLogins (LoginName varchar(128)) INSERT NewLogins VALUES ('BBrown'), ('CChaplin'), ('DDyer'), ('EEbbers')
Use dynamic SQL and a cursor to perform four actions for each row in this table: (1) create a login with a temporary password based on the first four letters of the login name followed by 99999; (2) set the default database to the AP database; (3) create a user for the login with the same name as the login; and (4) assign the user to the PaymentEntry role.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
