SQLserver单表数据导入导出
生活随笔
收集整理的這篇文章主要介紹了
SQLserver单表数据导入导出
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 EXEC sp_configure 'show advanced options', 1
2
3 GO
4
5 RECONFIGURE
6
7 GO
8
9 EXEC sp_configure 'xp_cmdshell', 1
10
11 GO
12
13 RECONFIGURE
14
15 GO
16 //導出
17 EXEC userinfo..xp_cmdshell 'bcp userinfo.dbo.students out D:studentes.txt -c -T -U''sa'' -P''123456'''
解釋一下 導出
userinfo:數據庫名稱
students:表名
D:students.txt:導出路徑和導入文件名稱和類型
sa:用戶名
123456:密碼
? 導入
1 //導入 2 EXEC userinfo..xp_cmdshell 'bcp userinfo.dbo.students in D:studentes.txt -c -T -U''sa'' -P''123456''' 3 4 EXEC sp_configure 'show advanced options', 1 5 6 GO 7 8 RECONFIGURE 9 10 GO 11 12 EXEC sp_configure 'xp_cmdshell', 0 13 14 GO 15 16 RECONFIGURE 17 18 GO導入和上面一樣,但是要注意,
執行完導出或導入工作后,出于對數據庫安全性的考慮一定要禁用 'xp_cmdshell'
我們弄完了要把SQLserver的值改回去,否則會出現各種異常。
轉載于:https://www.cnblogs.com/duwenlei/p/3513682.html
總結
以上是生活随笔為你收集整理的SQLserver单表数据导入导出的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android自定义进度条渐变色View
- 下一篇: Android 下拉刷新