Importing data
The crash data has many columns that store the data in codes. In order to make this data useful for reporting, we need to add description columns. In this section, we will create four code tables by importing data into a SQL Server database. Then, we will add the tables to your existing model.
Getting ready
In the Chapter 3 database on your SQL Server, run the following scripts to create the four tables and populate them with the reference data:
Create the
Major Cause
of Accident Reference Data table:CREATE TABLE [dbo].[MAJCSE_T]( [MAJCSE] [int] NULL, [MAJOR_CAUSE] [varchar](50) NULL ) ON [PRIMARY]
Then, populate the table with data:
INSERT INTO MAJCSE_T VALUES (20, 'Overall/rollover'), (21, 'Jackknife'), (31, 'Animal'), (32, 'Non-motorist'), (33, 'Vehicle in Traffic'), (35, 'Parked motor vehicle'), ...