May 31, 2018 at 7:29 am
Hi, I'm new to this forum so I don't know if this is the right lace to be asking this but does anyone know where I can get a copy of AdventureWorksDW2008? I can find 2008R2 on Github but not 2008. I need 2008 for training purposes as I have a bunch of SQL scripts that works for the 2008 database but not for the 2008R2 database as the names of the tables are different.
Any help on this would be great.
June 1, 2018 at 4:44 am
Andrew P - Friday, June 1, 2018 4:23 AMI've extracted AdventureWorksDW2008 from the Microsoft SQL Server Product Samples: Database archive on CodePlex to Google Drive here.Andrew P.
Thanks for that Andrew, what do I do with the .mdf and .ldf files? I only have experience restoring from a .bak file.
June 1, 2018 at 4:57 am
You should be able to attach them. In SSMS right-click on Databases and select Attach, then browse to the correct directories.
June 1, 2018 at 5:25 am
Beatrix has given a good explanation of how to use these files. Here's an attempt at explaining what these files are.
MDF stands for Master Data File, and LDF stands for Log Data File. These are the two main database files for a database. The MDF file holds the actual data stored in your database, and the LDF file holds either a history of the changes that have been made since the last backup, or changes to the data that have been began but not yet completed (depending on which recovery model the database is set up to use). You can't delete an MDF or LDF file while your database is attached and accessible in SQL, because SQL Server will have it locked for use.
A .BAK file is comparable to a ZIP file of your database. It holds a backup of your database that needs to be restored before it can be accessed, and after the database has been restored, the .BAK file can be deleted. In contrast, the MDF and LDF files are the extracted files for a specific database that SQL can read and write directly to and from.
I'm not sure why Microsoft distribute their samples in MDF/LDF format.
Andrew P.
June 1, 2018 at 5:41 am
I've attached the DB and ran one of my scripts but it looks like a table is missing (dbo.DimDate)
Are you sure this is definitely AdventureWorksDW2008?
June 1, 2018 at 7:13 am
mharbuz - Friday, June 1, 2018 5:41 AMI've attached the DB and ran one of my scripts but it looks like a table is missing (dbo.DimDate)Are you sure this is definitely AdventureWorksDW2008?
Just for some background info the script I'm trying to run is as follows:
SELECT t.CalendarYear,
pc.EnglishProductCategoryName ProductCategoryName,
ps.EnglishProductSubcategoryName ProductSubcategoryName,
p.EnglishProductName ProductName,
SUM(s.SalesAmount) SalesAmount
FROM
dbo.FactInternetSales s
JOIN dbo.DimDate t
ON t.DateKey = s.OrderDateKey
JOIN dbo.DimProduct p
ON p.ProductKey = s.ProductKey
JOIN dbo.DimProductSubCategory ps
ON ps.ProductSubcategoryKey = p.ProductSubcategoryKey
JOIN dbo.DimProductCategory pc
ON pc.ProductCategoryKey = ps.ProductCategoryKey
WHERE
t.CalendarYear = '2004'
GROUP BY
t.CalendarYear,
pc.EnglishProductCategoryName,
ps.EnglishProductSubcategoryName,
p.EnglishProductName
ORDER BY
pc.EnglishProductCategoryName,
ps.EnglishProductSubcategoryName,
p.EnglishProductName
However it does not run as the dbo.DimDate does not exist.
June 1, 2018 at 7:23 am
Ignore my last two replies, I realise that the dbo.DimTime is what I need.
Thanks guys for all the help 🙂
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply