27,580
社区成员
发帖
与我相关
我的任务
分享
--MS SQL 2000
--建表
create table temp
(
col1 int
,col2 int
,col3 int
,col4 int
);
--如果服务器是本机
--运行这条语句
exec xp_cmdshell 'bcp temp in C:\dir\test1.txt -S 10.10.10.33 -U award -P query -c -t "|"';
--如果服务器不在本机
--打开命令行,运行这条指令
bcp temp in C:\dir\test1.txt -S 10.10.10.33 -U award -P query -c -t "|"
--其中
--temp:你的表名
--C:\dir\test1.txt:数据文件路径
--10.10.10.33:你本机地址,或者你的服务器名
--award:你的登陆数据库用户名,比如sa
--query:你的登陆密码
--"|":数据文件中字段间的分隔符是|
--查看导入结果
select * from temp;
--去除重复
select distinct *
into result
from temp;
--查看去重复后的结果
select * from result;
--2005等高手贴导入新功能