Question: If I have the following code, what alterations do I need to make to meet the requirements i,ii, & iii below. We have created our

If I have the following code, what alterations do I need to make to meet the requirements i,ii, & iii below. We have created our new database and I think this code from Create procedure through EXEC will do what I need for the assingment, but i'm just not sure. If I have the following code, what alterations do I need to

- You will modify this script so that the procedure accepts Start Date and End Dates as arguments or parameters and then generate all dates between the provided start and end dates. The start and end dates should NOT be hardcoded. In addition to generating the date, we will also generate month number and month name as well as year number and year name. Quarters do not need to be generated.The generated dates. Month, and years values will be used to populate the DimDatestable1 in your D_PubSales database. Your procedure should accomplish the following:

i.Check to see if DimDates1 table exists in D_PubSales database. If it exists, flush thae table and then repopulate it. If the table does not exist then create it. Its structure should be similar to DimDates but without the fields associated with quarters. ii. Next, the script should generate date values as specified above based on the start and end dates provided. Have the script insert these values into the DimDates1 table. iii. Finally, the procedure should retrieve all values in the DimDates1 table to demonstrate the script actually works and populates the DimDates1 table.

So my DimDates (original) looks like this: make to meet the requirements i,ii, & iii below. We have created

This is using SQL server.

Create procedure ap_PopulateFactSales AS BEGIN Insert into DWPubsales.dbo.FactSales (OrderNumber, SalesQuantity, OrderDateKey, StoreKey, TitleKey) (Select from dbo. Vw_selectdataforfactsales) END Select*From DWpubsales.dbo.factsales Delete from dwpubsales.dbo.factsales EXECUTE dbo.sp_populatefactsales Delete from Dimd ates exec dbo. sp_populatedimsales '01/01/2010" 02/15/2015 Create procedure ap_PopulateFactSales AS BEGIN Insert into DWPubsales.dbo.FactSales (OrderNumber, SalesQuantity, OrderDateKey, StoreKey, TitleKey) (Select from dbo. Vw_selectdataforfactsales) END Select*From DWpubsales.dbo.factsales Delete from dwpubsales.dbo.factsales EXECUTE dbo.sp_populatefactsales Delete from Dimd ates exec dbo. sp_populatedimsales '01/01/2010" 02/15/2015

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!