In enterprises, various data are distributed in various scenarios. For example, an enterprise may use an Excel or My SQL database before adopting an SQL Server database. They have different formats and different storage locations. However, managers may need to use various data in decision-making. In this case, the user will encounter a problem. How can we aggregate the data in different formats and geographic locations for analysis? To solve this problem, a service called DTS (data conversion) is proposed in the SQL Server database. This tool allows the database administrator to extract, convert, and even merge data from different sources (in different formats) to a specific purpose (such as SQL Server database ), to meet the needs of statistical analysis.
It can be said that the data conversion Service provides a set of tools to help database administrators solve problems such as initial data import and data merging and analysis. Specifically, it has the following four advantages.
1. Import and export data.
When enterprises deploy information projects, a headache is the import of basic data. At present, most enterprises must have a certain level of informatization when implementing information projects, such as ERP projects. In the simplest way, at least some information, such as product information or basic customer information, may have been recorded using office software such as excle. Therefore, when they deploy the ERP system, it will increase a lot of additional work if they allow employees to input information one by one. According to my understanding, many enterprises make slight modifications based on the original data, such as removing unnecessary content or modifying some inaccurate information, and then directly importing it to the database.
However, the import may fail due to format incompatibility or other problems during the import process. However, errors cannot be recorded using common tools, such as SQL Server Import tools. When using these tools to import data, if an error occurs, the import process is terminated. In this case, the database administrator needs to re-check the data source (sometimes the database does not prompt which record has a problem ). The data import efficiency is very low.
The data conversion service can help us solve this problem. For example, the data conversion service can import data in text format or Excel files to the SQL Server database. Most importantly, if a record in the original data source is faulty, the entire import process will not be interrupted. After the import is complete, the data conversion service generates a report. This report details the records that were not successfully imported and possible problems. If the number of records is small, the database administrator only needs to manually enter the data. If the number of records is large, the database administrator can also import the data in batches and import the required records; then modify the records that do not conform to the format according to the import report. After the modification is complete, continue importing the remaining data.
Obviously, using this data conversion tool, it is much easier to import records of different formats. At the same time, the data conversion service can export the content in the SQL Server database to some specific objects, such as Excel tables.
Therefore, the data import and export function of the data conversion service is useful for importing and exporting large amounts of data and importing data sources of different formats. For example, the data conversion service can import records of large text file formats to the SQL Server database at high speed.
Ii. Use Data Conversion to standardize the format of imported data.
the data conversion service allows the database administrator to import data to the SQL Server database without modifying the original data, adjust the format of the data to be imported or use some functions for operations. For example, the database administrator needs to import data from an excle table, but there is a column of product numbers in the excle table, which is generic data. However, in SQL Server databases, integer data is required. If you do not have a Data Conversion Tool, the database administrator must first convert the format in the Excel table, and then import the converted data to the SQL Server database. If you use the data conversion service to import data, you can use a function to convert the data type during the import process without modifying the original data source.
Let's talk about a real case. This problem occurs when I import basic data to a customer. Before using the SQL Server database, they used the ACCESS database. There is a basic product information table in this database, including product keywords and product categories. When you need to import the content in this database to SQL Server, you must add different prefixes to the product numbers based on the product category. If the product is a finished product, add P before the product number. If the product is a packaging material, add B before the original product number. If the product category is a part, then add m and so on. In this case, I have not changed the original data source. Instead, DTS uses relevant functions, such as merge functions, to adjust the format before importing data to the SQL Server database. Therefore, one benefit of the data conversion service is that you can standardize the data format to be imported without changing the original data source. This is useful when heterogeneous data sources are imported to each other.
Another colleague of the author has encountered similar problems. For example, when he imports a database table to a user, he also needs to perform some data conversion. When the inventory quantity is greater than or equal to 0, the imported value is the original inventory quantity. If the inventory quantity of the original database is less than 0, the imported inventory quantity is 0. During the import process, my colleagues simply wrote an ActiveX script to meet this requirement. In this script, you can use functions such as if to convert data, because these functions can be applied to specialized transformations or contain conditional logic. In this way, records can be converted to appropriate data or formats based on different condition logics.
Therefore, if you want to convert the data format or other aspects during data import, we recommend that you use DTS to convert the data and import it to the database.
3. Copy database objects during import.
If you directly use tools such as ODBC to import data from other sqlserver databases to sqlserver databases, you can only import data, but cannot copy objects in database tables, such as constraints, indexes, and primary keys. In addition, basic table-based database objects such as views, stored procedures, and default values cannot be imported.
In the SQL Server database, the database administrator can copy objects from one database instance to another through the database object replication task. You can transmit basic objects or copy the definitions of some objects. If an object is selected, the copy object task automatically copies any associated objects, such as table lakes or views. The premise is that these replicated objects have foreign key constraints on the selected objects.
However, data transmission can also replicate database objects while importing data, such as views, stored procedures, triggers, rules, default values, and user-defined data types. This is a function that cannot be implemented by data import tools such as ODBC. If you want to copy a large number of database objects, the database administrator can also copy these database objects through scripts.
Copying database objects is very useful in actual work and ensures the consistency and integrity of data import. For example, the database administrator wants to import the customer information table from other databases. The customer information table must reference the contact information table and address information table. That is to say, two fields in the customer information table are the foreign keys of the two tables. By copying an object job, the database automatically copies the table or other database objects associated with the customer information table. Instead of using the database administrator to manually import other associated data.
4. Perform some automated operations.
In database management, the database administrator wants the database to automatically collect information and send the information to a specified location, such as an email. In data conversion tasks, a series of similar tools are provided to simplify the work of database administrators. For example, in data transmission, there is a tool for sending emails. Through relevant settings, the database will automatically send an email to the database administrator when the package is successful or fails to remind him whether the job is successful or failed. Detailed information will be attached to facilitate subsequent operations by the database administrator.
The data conversion function also contains a package execution task, which is a package running step. This makes our work more automated. For example, during the Database Import process, we can use the package running plan to write the data tables to be imported to the execution package plan step by step. When the database is relatively idle, data is automatically imported in order. The Database Administrator does not have to run commands.
It can be seen that the data conversion service is a powerful service. In the process of data import and conversion, I recommend this tool first. Especially when the data volume is large, this data conversion service can indeed play a very important role.