Bài giảng Cơ sở dữ liệu nâng cao - Chapter 4: Transferring data and using service broker
lượt xem 9
download
Bài giảng Cơ sở dữ liệu nâng cao - Chapter 4: Transferring data and using service broker. Nội dung chính trong chương này gồm có: Introduction, performing a bulk load, performing a bulk insert task, importing bulk XML data, overview of SQL server integration services, using the import/export wizard, service broker.
Bình luận(0) Đăng nhập để gửi bình luận!
Nội dung Text: Bài giảng Cơ sở dữ liệu nâng cao - Chapter 4: Transferring data and using service broker
- CHAPTER 4 Transferring Data and using Service Broker
- Agenda • Introduction • Performing a Bulk Load • Performing a Bulk Insert task • Importing Bulk XML data • Overview of SQL Server Integration Services • Using the Import/Export Wizard • Service Broker
- Introduction • A common task when working with a database is importing data from other sources. • One of the most frequently used methods of transferring data. • There are different methods you can use to efficiently import files into SQL Server • bulk copy program (bcp) • the BULK INSERT Transact-SQL command • the OPENROWSET Transact-SQL function • the SQL Server Integration Services (SSIS) Import/Export Wizard
- Performing bcp utility • Because bcp is a program, you do not execute it from within a query window or batch but rather from the command line. • It is an external program, which means it runs outside of the SQL Server process • bcp to bulk copy data either into or out of SQL Server.
- Performing bcp utility • Two limitations of bcp: • bcp has limited data-transformation capabilities. If the data that you are loading needs to go through complex transforms or validations, bcp is not the correct tool to use. • bcp has limited error handling capabilities. bcp might know that an error occurred while loading a given row, but it has limited reaction options
- Performing bcp utility bcp {dbtable | query} {in | out | queryout | format} datafile [option] Option Description -S Instance name -T -T Indicates that you wish BCP to connect using a trusted connection -U login name when not using –T -P the password associated with the –U login name -c Use a character data file type -w Use a Unicode data file type -t Field terminator -r Row terminator
- Performing bcp utility • bcp Command-Line Syntax bcp {dbtable | query} {in | out | queryout | format} datafile [option,..n] Example about the simplest command bcp FileImportDB..Exam out "c:\FileImportPractice\ExamImportFile.txt" -T –w bcp FileImportDB..Exam in "c:\FileImportPractice\ExamImportFile.txt" -T -w
- BULK INSERT statement • Closely mimics the BCP command line utility • Two of the biggest differences between bcp and BULK INSERT BULK INSERT bcp can only import data can either import or export data Run inside the SQL Server Executed from the command process space and is executed line and runs outside of the from a query window or query SQL Server process space, batch
- BULK INSERT statement BULK INSERT {dbtable} FROM {datafile} [WITH (option)]
- BULK INSERT statement • Example: BULK INSERT FileImportDB..Exam FROM 'c:\FileImportPractice\ExamImportFile.txt'
- Importing Bulk XML data • SQL Server provides several options for importing XML documents. You can use the OPENROWSET Transact-SQL function to read data, including XML data, from a file. • SQL Server also offers many ways to transfer data: • OPENXML and XML stored procedures • the XML data type’s nodes() method • the SQLXML middle-tier API to load XML data as relational data • In this lesson, we will focus to OPENROWSET to read data from a file.
- Importing Bulk XML data • OPENROWSET function can be used in any standard SQL statement as a table reference. • There are many uses of the OPENROWSET function, including using the function as a target of an INSERT, UPDATE, or DELETE query.
- Importing • Example: INSERT INTO Documents(XmlCol) SELECT * FROM OPENROWSET( BULK 'c:\XMLDocs\XMLDoc9.txt', SINGLE_BLOB) AS x • This statement bulk imports the contents of the ‘c:\XMLDocs\XMLDoc9.txt’ file as a SINGLE_BLOB and inserts that BLOB into the XmlCol of a single row in the Documents table. • The SINGLE_BLOB format tells the OPENROWSET function to treat the entire file as a single unit, rather than parsing it in some way.
- Overview of SQL Server Integration Services • The SQL 2000 platform used Data Transformation Services (DTS) 2005 and 2008 platforms use Integration Services. • SSIS builds on the basic principles of DTS, but expands its capabilities to include additional, easier-to-manage, features. • Integration Services provides enterprise-level data integration and workflow solutions that have as their goal the extraction, transformation, and loading (ETL) of data from various sources to various destinations. • SSIS includes a wide range of tools and wizards to assist in the creation of the workflow and data flow activities that you need to manage in these complex data-movement solutions.
- Overview of SQL Server Integration Services • SSIS has 4 components: • Integration Services itself • Integration Services object model • Integrated Services runtime • Integrated Services dataflow
- Overview of SQL Server Integration Services • Integration Services: • Managed through SQL Server Management Studio • Used to handle the management and monitoring of both stored and running packages. Packages can be stored in the file system or they can be stored in the msdb database on a running instance of SQL Server 2008.
- Overview of SQL Server Integration Services • Integration Services features: • Starting and stopping local and remote packages. • Monitoring local and remote packages. • Importing and exporting packages from different sources. • Managing the package store. • Customizing storage folders. • Stopping running packages when service is stopped • Viewing the Windows Event Log. • Connecting to multiple SSIS server instances.
- Overview of SQL Server Integration Services • Integration Services Object Model: • The managed application programming interface (API) used to access SSIS tools, command-line utilities, and custom applications is the SSIS object model.
- Overview of SQL Server Integration Services • Integration Services Runtime Engine: • is responsible for saving the control flow logic and execution of SSIS packages. • include packages, containers, pre-defined and custom tasks, and event handlers. • The run time handles execution order, logging, variables, and event handling. Programming the Integration Services runtime engine allows you to automate the creation, configuration, and execution of packages through the object model.
- Overview of SQL Server Integration Services • Integration Services Runtime Engine includes: • Integration Services Packages: are units of execution that are composed of a series of other elements, including containers, tasks, and event handlers. • Integration Services Tasks: are the basic unit of work. Each task defines an action that will be taken as part of the execution of this package. • Integration Services Containers: define one or more tasks as a unit of work. • Integration Services Event Handlers: similar to packages. • One major difference, though, is that event handlers are reactionary – the tasks defined within an event handler will only be executed when a specific event occurs
CÓ THỂ BẠN MUỐN DOWNLOAD
-
Bài giảng Cơ sở dữ liệu đất đai
49 p | 644 | 80
-
Bài giảng Cơ sở dữ liệu - Nguyễn Quỳnh Chi
189 p | 270 | 51
-
Bài giảng Cơ sở dữ liệu: Bài 1 - ĐH CNTT
15 p | 610 | 30
-
Bài giảng Cơ sở dữ liệu nâng cao - Chương 2: Toàn vẹn và cơ sở dữ liệu active
50 p | 82 | 8
-
Bài giảng Cơ sở dữ liệu - Chương 4: Chuẩn hóa cơ sở dữ liệu
30 p | 135 | 8
-
Bài giảng Cơ sở dữ liệu: Chương 1 - Ths. Lê Ngọc Lãm
19 p | 125 | 7
-
Bài giảng Cơ sở dữ liệu (Database): Chương 1 - TS. Đặng Thị Thu Hiền
53 p | 51 | 7
-
Bài giảng Cơ sở dữ liệu: Mở đầu - ThS. Lương Thị Ngọc Khánh
11 p | 177 | 6
-
Bài giảng Cơ sở dữ liệu nâng cao: Bài 1.1 - PGS.TS. Đỗ Phúc
25 p | 90 | 6
-
Bài giảng Cơ sở dữ liệu – Database EE4253: Chương 3.2 - Ngôn ngữ định nghĩa và thao tác dữ liệu (TT)
40 p | 88 | 5
-
Bài giảng Cơ sở dữ liệu: Bài thực hành Cơ sở dữ liệu 1 - Lê Nhị Lãm Thúy
18 p | 52 | 5
-
Bài giảng Cơ sở dữ liệu: Chương 1 - Th.S Thiều Quang Trung
40 p | 94 | 5
-
Bài giảng Cơ sở dữ liệu - Bài 1: Thiết kế Cơ sở dữ liệu với Management Studio
10 p | 63 | 5
-
Bài giảng Cơ sở dữ liệu nâng cao: Bài 2 - PGS.TS. Đỗ Phúc
55 p | 68 | 4
-
Bài giảng Cơ sở dữ liệu: Chương 1 - GV. Đỗ Thị Kim Thành
21 p | 104 | 4
-
Bài giảng Cơ sở dữ liệu: Chương 2 - Trần Thị Dung
39 p | 8 | 4
-
Bài giảng Cơ sở dữ liệu: Chương 1 - ThS. Trần Quang Hải Bằng
15 p | 110 | 3
-
Bài giảng Cơ sở dữ liệu: Bài 1 - ThS. Vũ Văn Định
15 p | 78 | 2
Chịu trách nhiệm nội dung:
Nguyễn Công Hà - Giám đốc Công ty TNHH TÀI LIỆU TRỰC TUYẾN VI NA
LIÊN HỆ
Địa chỉ: P402, 54A Nơ Trang Long, Phường 14, Q.Bình Thạnh, TP.HCM
Hotline: 093 303 0098
Email: support@tailieu.vn