Presentation is loading. Please wait.

Presentation is loading. Please wait.

Importing Data from a Spreadsheet If you came to this presentation via a web browser, right-click and choose “Full Screen” before proceeding. Click mouse.

Similar presentations


Presentation on theme: "Importing Data from a Spreadsheet If you came to this presentation via a web browser, right-click and choose “Full Screen” before proceeding. Click mouse."— Presentation transcript:

1 Importing Data from a Spreadsheet If you came to this presentation via a web browser, right-click and choose “Full Screen” before proceeding. Click mouse or press space bar to continue. This presentation was prepared by Professor Steve Ross, with the advice of other MIS Faculty, for use in MIS Classes at Western Washington University. Please contact Dr. Ross for permission to use in other settings..Dr. Ross The Sister Cities Database Development Project

2 Introductory Slides If you are reading this slide, by this time you should have successfully … 1.Analyzed the original spreadsheet data, 2.Modified the data, and 3.Imported the data into a database table created by the import wizard. Now you are ready for the final steps 4.Design the final, permanent table 5.Transform that table into the final table 6.Verify the results. Original Data  Modified Data  “Import” Table  “Final” Table Convert

3 Creating the perfect home for your data These slides introduce a basic approach to transform the imported table and its data into the final table. We will use SQL Server Management Studio’s GUI tools to modify the design of the new tables. Before that, however, we need to: –Backup up the table (in case something goes wrong) –Analyze the datatypes and the size of the data.

4 Make a Backup Copy of the Imported Table Right-click on the table  Script Table as … (etc. as illustrated) Add “BACKUP” to the name of the new table  run the script

5 Estimate the size of each Field (1) Estimate the size required for each field to comfortably hold all data without being so large that it is wasteful. Right-click import table name, Choose Select Top 1000 Rows

6 Estimate the size of each Field (2) Modify the SELECT query … a.Remove “TOP 1000” b.Add functions to determine maximum length of strings and maximum value of numbers: SELECT MAX(LEN([LastName])) AS [LastName],MAX(LEN([FirstName])) AS [FirstName],MAX(LEN([MidName])) AS [MidName],MAX([AnnualPay1000]) AS [AnnualPay1000],MAX(LEN([DepartmentName])) AS [DepartmentName],MAX(LEN([Rank])) AS [Rank],MAX([BudgetAuthorityIn1000]) AS [BudgetAuthorityIn1000],MAX([PersonalStaff]) AS [PersonalStaff],MAX(LEN([MailCode])) AS [MailCode] FROM [createdbexample].[dbo].[WorkersTab]

7 Estimate the size of each Field (3)

8 Modify the Table Rt-click on the table Select “Design” Change the Data Type (then the size, such as 25) of the attributes, as needed.

9 There be “Warnings” Because the field sizes have been changed, the wizard is warning that some data may be lost. Click “Yes”, then check your data (next slide).

10 Verify the Results  Inspect the table (right-click table name, choose Select Top 1000 Rows)  Data in expected columns  Numeric data format, ensure no loss  Character data, check for truncation


Download ppt "Importing Data from a Spreadsheet If you came to this presentation via a web browser, right-click and choose “Full Screen” before proceeding. Click mouse."

Similar presentations


Ads by Google