Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 sql

Author  Topic 

fmardani
Constraint Violating Yak Guru

433 Posts

Posted - 2005-09-13 : 16:21:33
Hi,
I can not get this sql to work with the AdventureWorks database.
I think it is to do with the new security schema. thanks
p.s. I incorrectly posted this into another session. sorry

SELECT SalesOrderHeader.SalesOrderNumber, Store.Name AS Store, SalesOrderHeader.OrderDate, Employee.FirstName AS SalesFirstName,
Employee.LastName AS SalesLastName, Employee.Title AS SalesTitle, SalesOrderHeader.PurchaseOrderNumber, ShipMethod.Name AS ShipMethod,
BillAddress.AddressLine1 AS BillAddress1, BillAddress.AddressLine2 AS BillAddress2, BillAddress.City AS BillCity,
BillAddress.PostalCode AS BillPostalCode, BillStateProvince.Name AS BillStateProvince, BillCountryRegion.Name AS BillCountryRegion,
BillAddress.Phone AS BillPhone, ShipAddress.AddressLine1 AS ShipAddress1, ShipAddress.AddressLine2 AS ShipAddress2,
ShipAddress.City AS ShipCity, ShipAddress.PostalCode AS ShipPostalCode, ShipStateProvince.Name AS ShipStateProvince,
ShipCountryRegion.Name AS ShipCountryRegion, ShipAddress.Phone AS ShipPhone
FROM sales.SalesOrderHeader LEFT OUTER JOIN
Person.Address AS BillAddress INNER JOIN
person.StateProvince AS BillStateProvince ON BillAddress.StateProvinceID = BillStateProvince.StateProvinceID INNER JOIN
person.CountryRegion AS BillCountryRegion ON BillAddress.CountryRegionCode = BillCountryRegion.CountryRegionCode ON
sales.SalesOrderHeader.BillToAddressID = BillAddress.AddressID LEFT OUTER JOIN
Person.Address AS ShipAddress INNER JOIN
person.StateProvince AS ShipStateProvince ON ShipAddress.StateProvinceID = ShipStateProvince.StateProvinceID INNER JOIN
person.CountryRegion AS ShipCountryRegion ON ShipAddress.CountryRegionCode = ShipCountryRegion.CountryRegionCode ON
sales.SalesOrderHeader.ShipToAddressID = ShipAddress.AddressID LEFT OUTER JOIN
humanResources.Employee ON SalesOrderHeader.SalesPersonID = humanResources.Employee.EmployeeID LEFT OUTER JOIN
purchasing.ShipMethod ON SalesOrderHeader.ShipMethodID = ShipMethod.ShipMethodID LEFT OUTER JOIN
sales.Store ON SalesOrderHeader.CustomerID = sales.Store.CustomerID

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-09-13 : 16:25:55
Duplicate:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55177

Tara
Go to Top of Page
   

- Advertisement -