1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > SQLserver单表数据导入导出

SQLserver单表数据导入导出

时间:2023-01-13 14:37:21

相关推荐

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', 110 11 GO12 13 RECONFIGURE14 15 GO16 //导出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 GO11 12 EXEC sp_configure 'xp_cmdshell', 013 14 GO15 16 RECONFIGURE17 18 GO

导入和上面一样,但是要注意,

执行完导出或导入工作后,出于对数据库安全性的考虑一定要禁用 'xp_cmdshell'

我们弄完了要把SQLserver的值改回去,否则会出现各种异常。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。