May 30, 2007 #1 steveot IS-IT--Management Joined Oct 27, 2003 Messages 1,635 Location US Anybody know a OSQL command to 1) Query a user and determine the users default database 2) Change the user default database using OSQL Using NT authenication
Anybody know a OSQL command to 1) Query a user and determine the users default database 2) Change the user default database using OSQL Using NT authenication
May 30, 2007 #2 gmmastros Programmer Joined Feb 15, 2005 Messages 14,912 Location US I'm not sure about getting the current default database, but you can change it with this... Code: osql -s[!]ServerName[/!] -E -Q"sp_defaultdb '[!]LoginName[/!]','[!]DefaultDatabase[/!]'" -George Strong and bitter words indicate a weak cause. - Fortune cookie wisdom Upvote 0 Downvote
I'm not sure about getting the current default database, but you can change it with this... Code: osql -s[!]ServerName[/!] -E -Q"sp_defaultdb '[!]LoginName[/!]','[!]DefaultDatabase[/!]'" -George Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
May 30, 2007 Thread starter #3 steveot IS-IT--Management Joined Oct 27, 2003 Messages 1,635 Location US Would the loginname be domain\username format? Upvote 0 Downvote
May 30, 2007 #4 gmmastros Programmer Joined Feb 15, 2005 Messages 14,912 Location US yes -George Strong and bitter words indicate a weak cause. - Fortune cookie wisdom Upvote 0 Downvote