I want to - join the day and month name memory variable tables, but need to have something to join to. PRINT 'Adding new dates to dbo.DimDate' GO SET NOCOUNT ON - Later we will be writing an INSERT INTO. Commented out for this project as future dates are OK - If the date is in the future, don't allow it, change to missing - IF > - SET = -1 RETURN GO + If there's any data prior to 2000 it was incorrectly entered, mark it as missing If the date is missing, or a placeholder for a missing date, set to the Id for missing dates Create a helper function to convert dates to a YYYYMMDD format Date Id. PRINT 'Done Creating AdventureWorksDW2014 ' TO N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\ DATA\AdventureWorksDW2014_log.ldf ', TO N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\ DATA\AdventureWorksDW2014_Data.mdf ', PRINT 'Restoring AdventureWorksDW2012 to AdventureWorksDW2014 'įROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\ Backup\AdventureWorksDW2012.bak ' PRINT 'Deleting AdventureWorksDW2014, if it exists 'ĮXEC _delete_database_backuphistory = N'AdventureWorksDW2014 ' Delete the database AdventureWorksDW2014 if it exists. NAME = N'AdventureWorksDW2012- Full Database Backup ', TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\ Backup\AdventureWorksDW2012.bak ' * Step 1 - Make a copy of AdventureWorksDW2012 and restore as AdventureWorksDW2014 */ PRINT 'Updating AdventureWorks2012 for Today - Starting ' * Be warned, if AdventureWorksDW2014 exists, it will be deleted as part of this process. It won 't change AdventureWorksDW2012 in anyway. This script is dependent on the AdventureWorks2012DW sample */ It will then update it for current dates. * This script will make a backup of the AdventureWorks2012DW database, then copy and restore it */ * AdventureWorks database Copyright (c) Microsoft. * Script Copyright (c) 2013 by Robert C. * Updating AdventureWorks2012 for Today */ Copy and paste into SQL Server Management Studio and it should work fine. Note some browsers don’t seem to render the script using the mono-spaced font I intend, but just ignore. I’ve now updated the script for 2014, thought I’d pass along the updated version. This will allow folks to demo date related queries and be able to simply use things like GETDATE or NOW without having to do funky math tricks to take into account the pitifully out of date offering. You can refer to AdventureWorks Database - Download Microsoft SQL Server 2008 R2 Sample Databases for SQL Server 2008 R2.A while back I did a post that contained a script to update the AdventureWorksDW2012 database to have dates for the 2013 time period. Please read Download AdventureWorks Sample Database for Microsoft SQL Server 2008 for SQL2008 sample databases. If you plan to download AdventureWorks SQL Denali sample databases to use other SQL Server versions than Microsoft SQL Server 2012 CTP 1, these sample SQL databases cannot be installed other versions than SQL Server 2012. You can download Microsoft SQL Server 2012 sample databases and install these databases (including Adventureworks sample database) from CodePlexĪlthough there were only two sample databases for SQL Server Denali CTP 1, now there are more than 10 sample database downloads for Microsoft SQL Server 2012 RTM in the target sample databases list.ĪdventureWorks2012_Data.mdf data file is main OLTP database sample data file among other sample database files.Īfter you download AdventureWorks sample database for Microsoft SQL Server 2012, you can refer to sql tutorial How to Attach Database in SQL Server 2012 in order to attach database AdventureWorks to SQL Server 2012 instance. SQL Server 2012 sample database download : SQL Server professional who have already download SQL Server 2012, Denali and install SQL Server 2012, are now ready to download sample databases for MS SQL Server 2012. If you will ask a T-SQL or SQL Server question to members of a database community, I believe that it a necessity to use MS SQL Server 2012 sample databases for sample data of your SQL question.īecause when you publish a sql script on one of these database forums, audience of your post should be able to reproduce the same output from your sql script easily.Īnd this is possible only if both parts have the same data, which is only possible if both parts install SQL Server 2012 sample databases like AdventureWorks sample database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |