Danh mục

Transfer Tables Between SQL Server Databases

Số trang: 9      Loại file: pdf      Dung lượng: 32.06 KB      Lượt xem: 7      Lượt tải: 0    
10.10.2023

Hỗ trợ phí lưu trữ khi tải xuống: 2,000 VND Tải xuống file đầy đủ (9 trang) 0
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Chuyển Bàn Giữa Cơ sở dữ liệu SQL Server Người dùng đôi khi cần phải chuyển giao (bản sao) các bảng cơ sở dữ liệu SQL Server giữa. Điều này thế nào-Để cho thấy làm thế nào để cho phép người dùng lựa chọn nhiều bảng
Nội dung trích xuất từ tài liệu:
Transfer Tables Between SQL Server Databases 7.4 Transfer Tables Between SQL Server DatabasesUsers sometimes need to transfer (copy) tables between SQL Server databases. ThisHow-To shows how to allow the user to choose multiple tables and copy them from onedatabase to another as well as tables from two different databases on two different SQLservers.One of the tasks your clients have you perform for them using the Enterprise Manager isto transfer objects, such as tables, between SQL Server databases. How do you create adialog box that would allow the user to transfer databases between two SQL Serverdatabases?TechniqueUnlike the earlier How-Tos in this chapter, you will be using the SQL-DTS object modelin addition to SQL-DMO. You can see the objects, properties, and methods that will beused from SQL-DTS in Table 7.7.Table 7.7. SQL-DTS Objects That Are Used to Perform the Transfer of Tables from One SQL Server Database to AnotherObject Property/MethodPackage Steps.New Tasks.New Steps.Add Tasks.Add ExecuteStep TaskName NameTask CustomTaskCustomTask Name SourceServer SourceUseTrustedConnection SourceDatabaseDestinationServerDestinationUseTrustedConnection DestinationDatabase CopyAllObjects IncludeDependencies IncludeLogins IncludeUsers DropDestinationObjectsFirst CopySchema CopyData AddObjectForTransferUsing the items just listed, you will create a form with options to transfer tables betweentwo SQL databases.StepsOpen and run the VB.NET -Chapter 7 solution. From the main Windows form, click onthe command button with the caption How-To 7.4. You will then see a form allowing youto pick SQL Servers on the network to transfer from and to. After you have chosen these,you can then select which databases you want to transfer from and to. After choosingfrom the database to transfer from, you are then presented with a list of tables to transferfrom. You can then highlight multiple tables, as shown in Figure 7.9. Figure 7.9. Transferring tables between SQL Server databases.Tip One of the options included as a property of the CustomTask object is IncludeDependencies. This option specifies whether to have DTS transfer related tables as well as the selected table(s). This could be put as an option on the form as well. For this example, I have it set to True. 1. Create a Windows Form. Then place the controls shown in Figure 7.9, with the following properties set as in Table 7.8. Table 7.8. Label, ListBox, and Command Button Controls Property Settings Object Property Setting Label Name Label1 Text From SQL Servers ListBox Name lstFromSQLServer Label Name Label2 Text To SQL ServersListBox Name lstToSQLServerLabel Name Label3 Text Transfer from DatabaseListBox Name lstFromDBLabel Name Label4 Text Transfer to DatabaseListBox Name lstToDBLabel Name Label5 Text Table(s) to TransferListBox Name lstTables SelectionMode MultiSimpleCommand Button Name btnTransfer Text &Perform Transfer2. On the form, add the code in Listing 7.18 to the Load event. This will look familiar from How-To 7.1. For an examination of the L ...

Tài liệu được xem nhiều: