OSQL is another very useful tool I and my group use very often.We used it to execute all the sql files in a folder against a given server and database.
Here is the batch file I use to check if all the user procedures and user defined functions in a database has a execute persmission for a user ROLE called 'APPUSER'.
This sample batch file also demonstrates how to execute sql queries using OSQL in a batch file.
:: Keep variables local
SET Query="select so.name from sys.objects so LEFT OUTER JOIN sys.database_permissions p on so.[object_id] = p.major_id inner JOIN sys.database_principals dp on dp.name = 'APPUSER' where so.Type IN ('P') and p.major_id is null"
ECHO ^>^> Running CheckIfAPPUSERIsGrantedExecuteOnAllProcs
ECHO ^>^> ----------------------------------------------
set /P server=^>^> Enter Server Name or Type exit to Exit: %=%
if "%server%"=="" goto serverif "%server%"=="exit"
set /P database=^>^> Enter Database Name or Type exit to Exit: %=%
if "%database%"=="" goto databaseif "%database%"=="exit"
:: Execute sql scripts
ECHO ^>^> Checking . . . Please Wait!
OSQL -E -S %1 -d %2 -n -m-1 -b -Q %Query%
IF ERRORLEVEL 1
ECHO ^>^> Critcal error while checking Database %2,Ending Checking.
:: Display complete message
ECHO Check Complete on database %2
Friday, January 30, 2009
IIS Manager Crashes on Start Windows 7, IIS 7.5, Power Shell 5.1. Here is the error I got in the event viewer. IISMANAGER_CRASH IIS Ma...
Update: 1/27/2013 I have got a very good response and feedback for the tool, I am working on the new version of it and soon will be relea...
If you have played with or is using System.DirectoryServices.ActiveDirectory, you might jump into the consclusio that "DirectorySearche...
A small utility written in c# to help get object information in SQL Server Management Studio quickly and easily. It can be used on any versi...