

- #Adventureworks2012 practice how to#
- #Adventureworks2012 practice upgrade#
- #Adventureworks2012 practice full#
- #Adventureworks2012 practice windows 7#
- #Adventureworks2012 practice series#
SELECT SalesOrderNumber + ' (' + STR(RevisionNumber, 1) + ')' AS OrderRevision, CONVERT(nvarchar(30), OrderDate, 102) AS OrderDateĦ. The order date converted to ANSI standard format (yyyy.mm.dd – for example 2015.01.31). The sales order number and revision number in the format () – for example SO71774 (2). You have been asked to retrieve data for a report that shows: SELECT CAST(CustomerID AS varchar) + ': ' + CompanyName AS CustomerCompany FROM SalesLT.Customer ĥ.Retrieve a list of sales order revisions The SalesLT.SalesOrderHeader table contains records of sales orders. You have been asked to provide a list of all customer companies in the format SELECT Salesperson, Title + ' ' + LastName AS CustomerName, Phone FROM SalesLT.Customer (ii)A column named CustomerName that displays how the customer contact should be greeted (for example, “Mr Smith”) You must write a query to create a call sheet that lists: Retrieve customer names and phone numbers Each customer has an assigned salesperson. SELECT Title, FirstName, MiddleName, LastName, Suffix FROM SalesLT.Customer ģ. Retrieve customer name data Create a list of all customer contact names that includes the title, first name, middle name (if any), last name, and suffix (if any) of all customers. Retrieve customer details Familiarize yourself with the Customer table by writing a Transact-SQL query that retrieves all columns for all customers.Ģ. Note: These are available on the internet but not available at single place hence I made an effort to bring them all together.ġ.

The main theme of this is to help the beginners to enhance their T-SQL capabilities on a phase by phase manner.
#Adventureworks2012 practice series#
So now, having followed the above guidance, you can start to following through some of the Microsoft examples and try stuff out fro yourself.I am writing a series of posts on AdventureWorksLT database which can be downloaded from the link AdventureworksLT2012.
#Adventureworks2012 practice how to#
The third and fourth lines show that SQL Server is upgrading the database from version 705 (SQL 2012 RC0) to version 706 (SQL 2012 RC1/RTM).įor more information on the versions of the MDF file and SQL Server product version, please see Pranavs blog post “ How to determine version of Local Sql Instance and your database“. The file activation failure is simply saying that the log file could not be found, you can see on the second line that SQL has created the required log file for you.
#Adventureworks2012 practice upgrade#
Database 'AdventureWorks2012' running the upgrade step from version 705 to version 706. Converting database 'AdventureWorks2012' from version 705 to the current version 706. New log file 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQL_2012\MSSQL\DATA\AdventureWorks2012_log.ldf' was created.

The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorks2012_Log.ldf" may be incorrect. The following message is displayed (this could vary if you’re not using SQL Server 2012): File activation failure. Next, add the database by running the following SQL (amend the filename to reflect the location of the file on your system): CREATE DATABASE AdventureWorks2012 ON ( FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQL_2012\MSSQL\DATA\AdventureWorks2012_Data.mdf') With SSMS open, connect to your database server and click New Query from the toolbar.
#Adventureworks2012 practice full#
For OWNER RIGHTS check that Full control is ticked, if not, tick it and then hit Apply and OK through the remaining dialog windows. To check and rectify this, browse to the file using Windows Explorer and right-click the datafile, select Properties, Security tab then Edit.
#Adventureworks2012 practice windows 7#
Some users have noted that if you’re using Windows 7 or 8 then you need to start SSMS as Administrator, I’m using Windows 7 and have had no problem running it up normally but it’s worth bearing in mind if you do hit an error.Īlso, you may encounter an “Access is denied” message when attempting to access the datafile – this is possibly the level of permissions on the data file itself. Once the download has completed, it is advisable to copy the data file to your DATA folder, in my case, this is located here: C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQL_2012\MSSQL\DATA. To get the datafile, browse to the Microsoft SQL Server Samples page on CodePlex and take the AdventureWorks2012 Data File. After installing SQL Server 2012, it is a good idea to download and add the sample database to your SQL Server instance.
