sqlcmd -S tcp:127.0.0.1,1433 -q "select @@version"
C:\Documents and Settings\caution>sqlcmd -S tcp:127.0.0.1,1433
1> use hostmonitor
2> select * from hmlog
1> use testdb
2> go
已將資料庫內容變更為 'TestDB'。
1> insert into table_1 values(1,2,3)
2> go
1> insert into table_1 values(null,2,3)
2> go
(1 個受影響的資料列)
1> insert into table_1 values(default,2,3)
2> go
(1 個受影響的資料列)
1> select * from table_1
2> go
sn name address
---------- ---------- ----------
0x00000000 2 3
0x00000000 2 3
(2 個受影響的資料列)
sqlcmd -S tcp:127.0.0.1,1433 -i input.sql
C:\DOCUME~1\caution>mode con: cp select=950
C:\DOCUME~1\caution>type input.sql
use testdb
select * from table_1
C:\DOCUME~1\caution>sqlcmd -S tcp:127.0.0.1,1433 -i input.sql -o output.txt
C:\DOCUME~1\caution>type output.txt
已將資料庫內容變更為 'TestDB'。
sn name address
---------- ---------- ----------
0x00000000 2 3
0x00000000 2 3
(2 個受影響的資料列)
C:\DOCUME~1\caution>
沒有留言:
張貼留言