|
-
Oct 5th, 2006, 09:54 PM
#1
Thread Starter
Lively Member
Setting SQL Permission using DOS command
hi all,
i would like to know the DOS command for the command in setting the permission in a SQL Server/DB. hope someone can help me in this. thks a million in advance.
longwar
-
Oct 5th, 2006, 11:42 PM
#2
Re: Setting SQL Permission using DOS command
You would run query analyzer from the command prompt passing the sql text as a parameter. This can also be done as a bat file or shelled in most other languages. [/color]
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 6th, 2006, 07:11 AM
#3
Re: Setting SQL Permission using DOS command
There is a command line version of QUERY ANALYZER that can run at a DOS prompt. With it you can execute QUERIES against a server/database.
From BOL:
osql Utility
The osql utility allows you to enter Transact-SQL statements, system procedures, and script files. This utility uses ODBC to communicate with the server.
Syntax
osql
[-?] |
[-L] |
[
{
{-U login_id [-P password]}
| –E
}
[-S server_name[\instance_name]] [-H wksta_name] [-d db_name]
[-l time_out] [-t time_out] [-h headers]
[-s col_separator] [-w column_width] [-a packet_size]
[-e] [-I] [-D data_source_name]
[-c cmd_end] [-q "query"] [-Q "query"]
[-n] [-m error_level] [-r {0 | 1}]
[-i input_file] [-o output_file] [-p]
[-b] [-u] [-R] [-O]
]
Operating-System Commands
Operating-system commands can also be executed by starting a line with two exclamation points (!!) followed by the command. The command recall facilities of Windows NT can be used to recall and modify osql statements. The existing query buffer can be cleared by typing RESET.
When running stored procedures, osql prints a blank line between each set of results in a batch. In addition, the "0 rows affected" message does not appear when it does not apply to the statement executed.
Using osql Interactively
To use osql interactively, type the osql command (and any of the options) at a command prompt.
You can read in a file containing a query (such as Stores.qry) for execution by osql by typing a command similar to this:
osql /U alma /P /i stores.qry
The file must include a command terminator(s).
You can read in a file containing a query (such as Titles.qry) and direct the results to another file by typing a command similar to this:
osql /U alma /P /i titles.qry /o titles.res
When using osql interactively, you can read an operating-system file into the command buffer with :r file_name. Do not include a command terminator in the file; enter the terminator interactively after you have finished editing.
-
Oct 6th, 2006, 07:37 AM
#4
Re: Setting SQL Permission using DOS command
Yes, thats what I was refering to but I didnt state teh query analyzer filename as I couldnt remember the difference between the isqlw and osql?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|