I'd like to run mssql script (file with extension sql). I installed Microsoft SQL Server 2008 and run in Command Prompt:

C:\Documents and Settings\useruser>osql -Usa -Ppassword -i "F:\Data\MyApplication\Scripts\CreateDb.sql"
[SQL Server Native Client 10.0]Named Pipes Provider: Could not open a connection to SQL Server [2].
[SQL Server Native Client 10.0]Login timeout expired
[SQL Server Native Client 10.0]A network-related or instance-specific error has occured while establishing a connection to SQL Server. Server is not found of not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.

I found that I should choose:

area configuration manager -> allow remote connection

Somewhere else I found that it is here:

Configuration Tools->SQL Server Configuration Manager; Configuration Tools->SQL Server Surface Area Configuration; SQL Server Management Studio Express ...

But I don't have anything like this. When I enter "Sql Server Configuration Manager" there are:
SQL Server Configuration Manager (Local)
SQL Server Services
SQL Server Network Configuration
Protocols for SQLEXPRESS
SQL Native Client 10.0 Configuration
Client Protocols

What should I do to get rid of these errors? How to run this script?


You need to specify "-S servername" to tell osql where to connect.

C:\Documents and Settings\scott>osql -Sapex2006sql -Usa -Ppassword
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.