Hi @Thelonius Monk , thanks for replying back.
<As the text was crossing 1600 characters, providing this as answer>
Its my bad, as we have provided permissions on schema and database, so all objects in this schemais available for testuser. We need to deny the permission to tables that we don't want to migrate. Below is updated script for the same.
--Run in master db
create login testlogin with password = 'password@123';
--Run in your database
create user testuser for login testlogin;
--Permission to create table
GRANT CREATE TABLE TO testuser;
--Permission to alter table
GRANT ALTER ON [dbo].[testtableA] TO testuser;
--Permission to select schema
GRANT SELECT ON SCHEMA :: dbo TO testuser WITH GRANT OPTION;
--Permission to alter schema
GRANT ALTER ON SCHEMA :: dbo TO testuser WITH GRANT OPTION;
--Permission to select,insert, update on dbo.testtableA schema (We need to add all tables that we want to migrate data from)
GRANT INSERT, SELECT , UPDATE ON [dbo].[testtableA] TO testuser;
--We need to provide deny permission for tables that we want to exclude. (We need to exclude all those tables that we don't want to migrate)
DENY INSERT, SELECT , UPDATE ON [dbo].[testtableB] TO testuser;
In this case while migrating the tables we will not see testtableB but all other tables in dbo schema will be available, so we need to deny permissions to other tables as well that we dont want to migrate.
Please note I also removed the alter permission in database as it overwrites other permissions. We can run below script to disable it for existing users:
DENY ALTER TO testuser;
Please let me know if this works, or else we can further discuss the same.
----------
If answer helps, you can mark it 'Accept Answer'