Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QSQL command and default database

Status
Not open for further replies.

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
 
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
 
Would the loginname be domain\username format?
 
yes


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top