• 主页
  • 基础类
  • 应用实例
  • 新技术前沿

关于试图创建了但调用老是有红线的问题

充满荆棘的路 2014-01-10 10:16:35


------------------------------------------------------------------
--目的:为了报表制作需要,去除房间的分区,产品类型,户型等
--author:hejun
--createdon:2010-7-4
------------------------------------------------------------------
CREATE VIEW [dbo].[es_roominfo]
AS
SELECT
p_project.buguid,
p_project.projguid,
p_project.projname,
p_building.bldguid,
p_room.roomguid,
p_room.Room,
p_Room.BldArea,
p_Room.Price,
p_room.Total,
p_room.HuXing,
p_building.BldFullName,
p_building.BldName,
( CASE WHEN REPLACE(p_building.bldfullname, p_project.projname + '-', '') = p_building.bldname
THEN '无分区'
ELSE REPLACE(REPLACE(p_building.bldfullname, p_project.projname + '-', ''),
'-' + p_building.bldname, '')
END ) AS yname,
p_BuildProductType.BProductTypeName,
p_BuildProductType.BProductTypeShortName,
p_BuildProductType.FirstLevelName,
p_room.FloorNo,
p_room.[Floor],
p_room.unit,
p_room.UnitNo,
p_room.Status,
p_room.SLControlDate ,
(CASE WHEN dbo.p_Room.MainRoomGUID IS NOT NULL THEN '是' ELSE '否' END) AS isattachroom ,
BldFullName+(CASE WHEN Unit<>'' THEN '-'+Unit+'-'+Room ELSE +'-'+Room END ) as RoomInfo ,
p_Room.RoomStru, p_room.No
FROM p_room
LEFT JOIN p_BuildProductType ON p_BuildProductType.BProductTypeCode = p_room.BProductTypeCode
INNER JOIN p_building ON p_building.bldguid = p_room.bldguid
INNER JOIN p_project ON p_Project.ProjGUID = p_Room.ProjGUID

创建语法,但调用的时候老是报红线,但能执行,但我把语句放到报表里面就不行了,求大神来解决一下
...全文
83 点赞 收藏 3
写回复
3 条回复
發糞塗牆 2014年01月10日
点一下这个,你那个应该是缓存问题而已
回复 点赞
以学习为目的 2014年01月10日
把你调用的语句贴出来看看,哪个地方报红线
回复 点赞
Mr_Nice 2014年01月10日
SELECT  p_project.buguid ,
        p_project.projguid ,
        p_project.projname ,
        p_building.bldguid ,
        p_room.roomguid ,
        p_room.Room ,
        p_Room.BldArea ,
        p_Room.Price ,
        p_room.Total ,
        p_room.HuXing ,
        p_building.BldFullName ,
        p_building.BldName ,
        ( CASE WHEN REPLACE(p_building.bldfullname, p_project.projname + '-',
                            '') = p_building.bldname THEN '无分区'
               ELSE REPLACE(REPLACE(p_building.bldfullname,
                                    p_project.projname + '-', ''),
                            '-' + p_building.bldname, '')
          END ) AS yname ,
        p_BuildProductType.BProductTypeName ,
        p_BuildProductType.BProductTypeShortName ,
        p_BuildProductType.FirstLevelName ,
        p_room.FloorNo ,
        p_room.[Floor] ,
        p_room.unit ,
        p_room.UnitNo ,
        p_room.Status ,
        p_room.SLControlDate ,
        ( CASE WHEN dbo.p_Room.MainRoomGUID IS NOT NULL THEN '是'
               ELSE '否'
          END ) AS isattachroom ,
        BldFullName + ( CASE WHEN Unit <> '' THEN '-' + Unit + '-' + Room
                             ELSE '-' + Room   -- 这个地方的第一个 + 去掉看看
                        END ) AS RoomInfo ,
        p_Room.RoomStru ,
        p_room.No
FROM    p_room
        LEFT JOIN p_BuildProductType ON p_BuildProductType.BProductTypeCode = p_room.BProductTypeCode
        INNER JOIN p_building ON p_building.bldguid = p_room.bldguid
        INNER JOIN p_project ON p_Project.ProjGUID = p_Room.ProjGUID
回复 点赞
发动态
发帖子
MS-SQL Server
创建于2007-09-28

1.4w+

社区成员

25.3w+

社区内容

MS-SQL Server相关内容讨论专区
社区公告
暂无公告