使用 sqlcmd 实用工具,可以在命令提示符处、在 SQLCMD 模式下的“查询编辑器”中、在 Windows 脚本文件中或者在 SQL Server 代理作业的操作系统 (Cmd.exe) 作业步骤中输入 Transact-SQL 语句、系统过程和脚本文件。此实用工具使用 OLE DB 执行 Transact-SQL 批处理。
语法
- sqlcmd
- [{ { -U login_id [ -P password ] } | –Etrusted connection }]
- [ -N encrypt connection ][ -C trust the server certificate ]
- [ -znew password ] [ -Znew password and exit]
- [ -S [protocol:]server[\instance_name][,port] ] [ -Hwksta_name ] [ -ddb_name ]
- [ -llogintime_out ] [ -A dedicated admin connection]
- [ -iinput_file ] [ -ooutput_file ]
- [ -f< codepage> | i:< codepage > [ < , o: < codepage > ] ]
- [ -u unicode output] [ -r [ 0 | 1 ] msgs to stderr ]
- [ -R use client regional settings]
- [ -q "cmdline query" ] [ -Q"cmdline query" and exit]
- [ -eecho input ] [ -tquerytime_out ]
- [ -Ienable Quoted Identifiers ]
- [ -v var = "value"...] [ -xdisable variable substitution ]
- [ -hheaders ][ -scol_separator ] [ -wcolumn_width ]
- [ -Wremove trailing spaces ]
- [ -k [ 1 | 2 ] remove[replace] control characters ]
- [ -ydisplay_width ] [-Ydisplay_width ]
- [ -b on error batch abort] [ -Vseveritylevel ] [ -merror_level ]
- [ -apacket_size ][ -ccmd_end ]
- [ -L [ c ] list servers[clean output] ]
- [ -p [ 1 ] print statistics[colon format]]
- [ -X [ 1 ] ] disable commands, startup script, enviroment variables [and exit]
- [ -? show syntax summary]
本文来自MSDN,仅作个人学习查阅之用。
参考:
阅读(544) | 评论(0) | 转发(0) |