Chia Sẽ Kinh Nghiệm Về IT



Tìm Kiếm Với Google
-


Gởi Ðề Tài Mới  Gửi trả lời
 
Công Cụ Xếp Bài
Tuổi 29-10-2015, 06:05 AM   #1
hoctinhoc
Guest
 
Trả Lời: n/a
Hướng dẫn cách Import, Export Table nhanh nhất (Bulk Insert)
Hướng dẫn cách Import, Export Table nhanh nhất

Có 3 cách Import, Export dữ liệu của Table

1. Insert

INSERT INTO TABLE2 SELECT * FROM TABLE1

2. Cách Import và Export bằng Wizard


3. Cách nhanh nhất là Bulk Insert


- Enable

How to Enable XP_CMDSHELL using SP_CONFIGURE

Trích dẫn:
Use Master
GO

EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE WITH OVERRIDE
GO

EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE WITH OVERRIDE
GO



Export table tên là FirstTable ra file csv , IBM2 là tên Server



Trích dẫn:

execute xp_cmdshell 'bcp ShrinkIsBed.dbo.FirstTable out c:\temp\FirstTable.csv -SIBM2 -T -n'

Import vào lại chính table FirstTable


Trích dẫn:
bulk insert ShrinkIsBed.dbo.FirstTable from 'c:\temp\FirstTable.csv'
with (DATAFILETYPE = 'native')

Import vào Table mới (tạm table SecondTable và import file vào)


Trích dẫn:
select * into ShrinkIsBed.dbo.SecondTable from ShrinkIsBed.dbo.FirstTable where 1=2 bulk insert ShrinkIsBed.dbo.FirstTable from 'c:\temp\FirstTable.csv'
with (DATAFILETYPE = 'native')


===================
1 vài Option chọn khi Import

with (DATAFILETYPE = 'native')

FIELDTERMINATOR = '^',

ROWTERMINATOR= '0x0a');

===================
http://www.databasejournal.com/featu...to-Another.htm


http://www.mytechmantra.com/LearnSQL...-SP_CONFIGURE/
  Trả lời ngay kèm theo trích dẫn này
Gửi trả lời


Công Cụ
Xếp Bài

Quyền Hạn Của Bạn
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is Mở
Hình Cảm xúc đang Mở
[IMG] đang Mở
Mã HTML đang Tắt




Bây giờ là 08:44 PM. Giờ GMT +7



Diễn đàn tin học QuantriNet
quantrinet.com | quantrimang.co.cc
Founded by Trương Văn Phương | Developed by QuantriNet's members.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.