Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use osql

2025-02-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use osql", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use osql" this article.

When operating in the multi-person login database interface, it is easy to have problems when accessing and processing data, and sometimes even crash. The OSQL statement is used to operate later.

The osql tool is a Microsoft Windows 32 command prompt tool that you can use to run Transact-SQL statements and script files, and then append the results to a file, which is efficient and convenient to run.

Here is an example of my work:

Osql.exe-S DB01\ BOOK-E-I D:\ tpp\ sql.txt save this sentence as a bat file.

In sql.txt is my sql statement. The example is as follows:

SELECT COUNT (zongji1_ID) as jsj_tushu

FROM bookstore

Go

SELECT COUNT (zongji2_ID) as sheke_tushu

FROM bookstore

Go

SELECT COUNT (zongji3_ID) AS wenxue_tushu

FROM bookstore

Go

At the cmd prompt, execute osql.bat > > shuju_20100729.log.

A brief description of the parameters:

Osql's-s

Specifies the default instance of SQL Server to connect to.

Osql's-e

Specify to connect to the local default instance using Windows authentication

Osql-I

Specifies the SQL statement file to load. When you don't want to type too many SQL statements, you can write it in a file and use this parameter as a batch to execute.

Also notice that the default installation path for osql is under C:\ Program Files\ Microsoft SQL Server\ 90\ Tools\ binn.

The above is all the content of this article "how to use osql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report