when executing 1 of following commands:
osql -e -s computername\instancename osql -e -s computername\instancename -i myscript.sql -o myoutput.rpt osql -e -q "select * northwind.dbo.shippers" osql -e -q "select * northwind.dbo.shippers" -o myoutput.rpt i getting following error:
[sql server native client 10.0]sql server network interfaces: connection string not valid [87]. [sql server native client 10.0]login timeout expired [sql server native client 10.0]a network-related or instance-specific error has occurred while establishing connection sql server. server not found or not accessible. check if instance name correct , if sql server configured allow remote connections. more information see sql server books online. however, able, without issue login , run select queries ssms.
how run queries against sql server 2008 using osql?
do have logged in account set user in sql server?
i work specific accounts , sql server logins instead of trusted logins, , specify database coordinates on command line -s, -d, -u, , -p options:
osql -s %servername% -u %username% -p %password% -d %dbname% for instance, if server name myserver\sql2008 , user name foo , password bar , database mydb, you'd use this:
osql -s myserver\sql2008 -u foo -p bar -d mydb and continue on rest of options after that.
if want use trusted connection, need go sql server management studio, , ensure current widows login added user , given appropriate permissions database, etc.
in ssms, connect server manually (the 'sa' user , password perhaps), , expand "security" node , @ logins. if logged in windows user isn't listed, you'll want right-click, add new login, , add current user.
then should able run trusted connection.
Comments
Post a Comment