请问各位:什么命令执行一个.sql档案

****** c:\a.sql

相当于oracle 中的@
---------------------------------------------------------------

isql -Usa -Ppassword -Sservername -ic:\a.sql

---------------------------------------------------------------

xp_cmdshell isql -Usa -Ppassword -Sservername -ic:\a.sql
---------------------------------------------------------------

isql 实用工具
isql 实用工具使您得以输入 Transact-SQL 语句、系统过程和脚本文件
语法
isql
[-?] ¦
[-L] ¦
[
{
{-U login_id [-P password]}
¦ -E
}
[-S server_name] [-H wksta_name] [-d db_name]
[-l time_out] [-t time_out] [-h headers]
[-s col_separator] [-w column_width] [-a packet_size]
[-e] [-x max_text_size]
[-c cmd_end] [-q "query"] [-Q "query"]
[-n] [-m error_level] [-r {0 ¦ 1}]
[-i input_file] [-o output_file] [-p]
[-b] [-O]
]

---------------------------------------------------------------

在查询分析器中执行sql文件
master.dbo.xp_cmdshell 'osql -U 用户名 -P 密码 -i c:\***.sql'

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus