mysql 建立索引的方法--创建视图

CREATE INDEX name_index ON class(NAME)


CREATE VIEW class_view AS SELECT * FROM class
SELECT * FROM class_view

展开阅读全文

sql2005视图建立索引

08-03

create view [dbo].[V_AddressListWithGroup]rnWITH SCHEMABINDING rnasrnSELECT dbo.AddressList.ALGuid, dbo.GroupAList.GALUserGuid, dbo.GroupAList.GALHit, dbo.AddressList.ALName, dbo.AddressList.ALHomePhone, rn dbo.AddressList.ALCity, dbo.AddressList.ALMsn, dbo.AddressList.ALOther, dbo.AddressList.RememberDate, dbo.AddressList.RememberRemark, rn dbo.AddressList.Head, dbo.AddressList.ALWorkPhone, dbo.AddressList.ALWorkFax, dbo.AddressList.ALMobile, dbo.AddressList.ALAddress, rn dbo.AddressList.ALEmail, dbo.AddressList.ALTitle, dbo.AddressList.ALCompany, dbo.AddressList.ALDepart, dbo.AddressList.ALHeadship, rn dbo.AddressList.ALCall, dbo.AddressList.ALPost, dbo.AddressList.ALHomePage, CASE WHEN GroupAList.GALOrder IS NULL rn THEN 0 ELSE GroupAList.GALOrder END AS GALOrder, dbo.GroupAList.GALGuid, dbo.GroupAList.GALGroupGuid, dbo.GroupAList.GALID, rn dbo.GroupAList.GALALGuid, dbo.GroupAList.GALType,dbo.GroupAList.GALSource,dbo.GroupAList.GALTime, dbo.AddressList.ALRemark, 0 AS DefaultOrganiseId, dbo.AddressList.UserPY, '' AS alSex, rn '' AS dummyNet, '' AS physicalDeliveryOfficeNamernFROM dbo.AddressList LEFT OUTER JOINrn dbo.GroupAList ON dbo.AddressList.ALGuid = dbo.GroupAList.GALALGuidrnUNION ALLrnSELECT zbOrganiseDB.dbo.UserB.UserGUID AS alGuid, dbo.GroupAList.GALUserGuid, dbo.GroupAList.GALHit, rn zbOrganiseDB.dbo.UserB.UserName AS alName, zbOrganiseDB.dbo.UserB.HomePhone AS alHomePhone, '' AS ALCity, '' AS ALMsn, '' AS ALOther, rn '' AS RememberDate, '' AS RememberRemark, '' AS Head, zbOrganiseDB.dbo.UserB.WorkPhone AS alWorkPhone, rn zbOrganiseDB.dbo.UserB.WorkFax AS alWorkFax, zbOrganiseDB.dbo.UserB.MobilePhone AS alMobile, rn zbOrganiseDB.dbo.UserB.Address AS alAddress, zbOrganiseDB.dbo.UserB.MaillAddress AS alEmail, zbOrganiseDB.dbo.UserB.ChengWei AS alTitle, rn zbOrganiseDB.dbo.UserB.company AS alCompany, zbOrganiseDB.dbo.UserB.DepName AS alDepart, zbOrganiseDB.dbo.UserB.duty AS alHeadShip, rn zbOrganiseDB.dbo.UserB.HuJiNu AS alCall, '' AS alPost, zbOrganiseDB.dbo.UserB.Url AS alHomePage, CASE WHEN GroupAList.GALOrder IS NULL rn THEN 0 ELSE GroupAList.GALOrder END AS GALOrder, dbo.GroupAList.GALGuid, dbo.GroupAList.GALGroupGuid, dbo.GroupAList.GALID, rn dbo.GroupAList.GALALGuid, dbo.GroupAList.GALType,dbo.GroupAList.GALSource,dbo.GroupAList.GALTime, CAST(zbOrganiseDB.dbo.UserB.remark AS varchar(7900)) AS AlRemark, rn zbOrganiseDB.dbo.UserB.DefaultOrganiseID, zbOrganiseDB.dbo.UserB.UserPY, zbOrganiseDB.dbo.UserB.Sex AS alsex, rn zbOrganiseDB.dbo.UserB.dummyNet, zbOrganiseDB.dbo.UserB.physicalDeliveryOfficeNamernFROM zbOrganiseDB.dbo.UserB LEFT OUTER JOINrn dbo.GroupAList ON zbOrganiseDB.dbo.UserB.UserGUID = dbo.GroupAList.GALALGuidrnrnrn 错误提示:无法将 视图'dbo.V_AddressListWithGroup' 绑定到架构,因为名称 'zbOrganiseDB.dbo.UserB' 对于架构绑定无效。名称必须由两部分构成,并且对象不能引用自身rnrn以为视图没有绑定到架构,就无法建立索引,网上找了一下 'zbOrganiseDB.dbo.UserB’应该写成‘dbo.UserB’,但是UserB是其它数据库中的表,不能去掉啊,请高人指点,感激不尽..... 论坛

没有更多推荐了,返回首页