當我在SQL Server 2005中創建一個視圖,並且稍後有人在GUI修改模式中打開它時,它有時會完全重新排列我的連接。通常,它幾乎不再可讀。如果我在GUI中查看它,它與我最初編寫的版本一樣。有時連接線不再指向一個字段,連接符號具有「fx」。我認爲它已經爲我優化了它。有沒有辦法來防止這種情況發生? 「fx」是什麼意思?爲什麼SQL Server的GUI會破壞我的視圖?
原來是這樣的:
FROM dbo.Stop LEFT OUTER JOIN dbo.StopType ON dbo.Stop.StopTypeID = dbo.StopType.StopTypeID LEFT OUTER JOIN dbo.CityState ON dbo.Stop。 City = dbo.CityState.City AND dbo.Stop.State = dbo.CityState.State LEFT OUTER JOIN dbo.vwDrivers ON dbo.Stop.DriverID = dbo.vwDrivers.DriverID LEFT OUTER JOIN dbo.truck ON dbo.Truck。 TruckID = dbo.Stop.TruckID INNER JOIN dbo.vwTicketIDFirstStopLastStop ON dbo.vwTicketIDFirstStopLastStop.TicketID = dbo.stop.ticketid LEFT OUTER JOIN dbo.Company ON dbo.Company.C ompanyID = dbo.vwTicketIDFirstStopLastStop.BillToCompanyID
現在就是這樣。
FROM dbo.Truck RIGHT OUTER JOIN dbo.Stop INNER JOIN dbo.StopType ON dbo.Stop.StopTypeID = dbo.StopType.StopTypeID LEFT OUTER JOIN dbo.CityState ON dbo.Stop.City = dbo.CityState .City AND dbo.Stop.State = dbo.CityState.State LEFT OUTER JOIN dbo.vwDrivers ON dbo.Stop.DriverID = dbo.vwDrivers.DriverID ON dbo.Truck.TruckID = dbo.Stop.TruckID LEFT OUTER JOIN dbo .vwTicketIDFirstStopLastStop LEFT OUTER JOIN dbo.Company ON dbo.Company.CompanyID = dbo.vwTicketIDFirstStopLastStop.BillToCompanyID ON dbo.vwTicketIDFirstStopLastStop.TicketID = dbostop.ticketid
你能給我們一個初始和重新排列視圖的例子S' – 2008-11-04 20:57:43
我在原始問題中添加了一個示例,謝謝。 – dwidel 2008-11-04 21:59:58