当我在SQL Server 2005中创建一个视图,后来有人在GUI修改模式下打开它时,它有时会完全重新排列我的连接。通常,它几乎不再可读。如果我在GUI中查看它,它也会改变我最初写的内容。有时连接线甚至不再指向字段,连接符号具有“fx”。我认为它已经为我“优化”了它。有没有办法防止这种情况发生? “fx”是什么意思?
最初它是这样的:
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.CompanyID = 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
答案 0 :(得分:3)
不,你不能。这就是为什么你永远不应该使用它。
“Fx”表示连接不是简单的列到列链接,而是涉及一个函数(当然,这也是它不能指向字段的原因)。但是,它本身不应该这样做,
答案 1 :(得分:1)
我讨厌视图GUI
我使用RightClick-> ScriptViewAs->更改To->新查询编辑器窗口
好多了:)
答案 2 :(得分:0)
这是视图GUI将SQL解析为自己的内部DOM样式格式然后将其写回来的结果 - 与HTML编辑器在XHTML中采用的方式非常相似,并以不同的方式发送内容:(< / p>