I was wondering if there was a fairly efficient way to use T-SQL with SQL Server 2000 syntax to GRANT SELECT, INSERT, UPDATE, DELETE, on all TABLES and VIEWS for a particular database while excluding 2 or 3 of the over 100 objects. I would also like to be able to grant EXEC privileges on all Stored Procedures.
Currently I'm using the below code to change them one by one. Doing this for about 100 tables and 100 views is taking far too long and will take even longer through the GUI (Unless I'm doing that wrong too).
use [DATABASE_NAME]
GO
GRANT DELETE ON [dbo].[table_name]TO [user_name]
GO
use [DATABASE_NAME]
GO
GRANT INSERT ON [dbo].[table_name]TO [user_name]
GO
use [DATABASE_NAME]
GO
GRANT SELECT ON [dbo].[table_name]TO [user_name]
GO
use [DATABASE_NAME]
GO
GRANT UPDATE ON [dbo].[table_name]TO [user_name]
GO
How can I use T-SQL to cycle through ALL of the User Tables and Views to grant certain priveleges while excluding a couple objects?