🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.database
Article #662

Re: ���bcp����

#662
From: Schumi
Date: Tue, 23 Dec 2008 12:47
96 lines
4481 bytes
BCP�����ĸ���������ѡ��

(1) ���롣

�������ʹ��in������ɣ��������Ҫ������ļ���

(2) ������

�������ʹ��out������ɣ��������Ҫ�������ļ���

(3) ʹ��SQL��䵼����

�������ʹ��queryout������ɣ����out���ƣ�ֻ�����Դ���DZ����ͼ�����SQL
��䡣

(4) ������ʽ�ļ���

�������ʹ��format������ɣ������ʽ�ļ���

�������һЩ���õ�ѡ�

-f format_file

format_file��ʾ��ʽ�ļ������ѡ�������������Ķ��������ʹ�õ���in��out��fo
rmat_file��ʾ�Ѿ����ڵĸ�ʽ�ļ������ʹ�õ���format���ʾ��Ҫ��ɵĸ�ʽ�ļ���


-x

���ѡ��Ҫ��-f format_file���ʹ�ã��Ա����xml��ʽ�ĸ�ʽ�ļ���

-F first_row

ָ���ӱ����������һ�е�������ӱ������ļ�����һ�е��롣

-L last_row

ָ����������Ҫ������һ�н����ӱ������ļ������ʱ��������һ�н���

-c

ʹ��char������Ϊ�洢���ͣ�û��ǰ׺����"\t"��Ϊ�ֶηָ����"\n"��Ϊ�зָ��
��

-w

��-c���ƣ�ֻ�ǵ�ʹ��Unicode�ַ������ʱʹ�ã�����nchar��Ϊ�洢���͡�

-t field_term

ָ���ַ�ָ��Ĭ����"\t"��

-r row_term

ָ���зָ��Ĭ����"\n"��

-S server_name[ \instance_name]

ָ��Ҫ���ӵ�SQL Server��������ʵ�����δָ����ѡ�BCP���ӱ����SQL Serve
rĬ��ʵ�����Ҫ����ij̨�����ϵ�Ĭ��ʵ��ֻ��Ҫָ��������ɡ�

-U login_id

ָ������SQL Sever���û���

-P password

ָ������SQL Server���û������롣

-T

ָ��BCPʹ���������ӵ�¼SQL Server�����δָ��-T������ָ��-U��-P��

-k

ָ������ʹ��nullֵ���룬�������е�Ĭ��ֵ��

BCP��ϵͳ���û�а취ʵ��̫���ӵ���ݿ�����ģ����null�����Ӱ��������Կ�
���ڵ���֮ǰ����ݿ��null���ж��������������Գ�����-k�IJ���


�� �� daodanw (����ÿһ��) �Ĵ������ᵽ: ��
: ��ṹ:
: ���� name char(14)
:      sub  char(400)
:      parent char(400)
:      class char(400)
: ����һ�����, �ֶγ���Ӧ��û����, ����txt�ļ���, ����Ӧ����4��,��Щ��¼ֻ��3��
: ,�鿴��һ��, ���ֵ�����ʱ����ݿ�����Щ��¼�ĵ�4���ǿ�(����null,��ʲô��û��).
: ��������: EXEC master..xp_cmdshell 'bcp tables..tt out C:\test.txt -c -S(local
: ) -Usa -P'.
: �Dz���Ҫ�ѵ�������ʲô����Ķ������,�����,��ô�޸ĵ�������?
: .................������ʡ�ԣ�
--

�� ��Դ:����ˮ˼Դ bbs.sjtu.edu.cn��[FROM: 122.225.10.197]
Technical Details
Message-ID: <4dYDjG$aOc@bbs.sjtu.edu.cn>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!87.106.137.111.MISMATCH!feeder1.news.weretis.net!newsfeeder.dynfx.net!weretis.net!newsfeed.datemas.de!news.isoc.lu!news.shec6.edu.cn!SJTU

Show Full Headers
Complete Article Headers
X-Google-Thread: 101948,30d5c9e02535f3e4
X-Google-Attributes: gid101948,domainid0,public,usenet
X-Google-Language: Chinese,GB
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!87.106.137.111.MISMATCH!feeder1.news.weretis.net!newsfeeder.dynfx.net!weretis.net!newsfeed.datemas.de!news.isoc.lu!news.shec6.edu.cn!SJTU
From: Goliath.bbs@bbs.sjtu.edu.cn (Schumi)
Newsgroups: cn.bbs.comp.database
Subject: Re: ���bcp����
Date: 23 Dec 2008 12:47:30 GMT
Organization: ��ˮ˼Դ
Message-ID: <4dYDjG$aOc@bbs.sjtu.edu.cn>
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: database/M.1230036352.A