Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 script in dos batch file

Author  Topic 

emilysdada
Starting Member

1 Post

Posted - 2002-06-05 : 15:36:33
I need to add a Windows group to a database, grant them access and give them dbowner access rights, and i need to do it in a batch file. ( 200 machines ).

The script below appears to work in query analyzer but how do I run it in a dos batch file.

USE ides
EXEC sp_grantlogin 'camisd010a\crmusers'
GO
EXEC sp_grantdbaccess 'crmusers', 'crmusers'
GO
EXEC sp_addrolemember 'db_owner', 'crmusers'


Any help you could be would be greatly appreciated.

Thank you in advance.

Ian Duncan

Sql 7 and Windows 2000 Pro

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-06-05 : 16:13:49
use the isql command line utility . . .
quote:

Syntax
isql -U login_id [-e] [-E] [-p] [-n] [-d db_name] [-Q "query"] [-q "query"]
[-c cmd_end] [-h headers] [-w column_width] [-s col_separator]
[-t time_out] [-m error_level] [-L] [-?] [-r {0 | 1}]
[-H wksta_name] [-P password]
[-S server_name] [-i input_file] [-o output_file] [-a packet_size]
[-b] [-O] [-l time_out] [-x max_text_size]
- SQL Server 7, Book Online



<O>
Go to Top of Page
   

- Advertisement -