

--1
IF NOT EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[View_Purchase_IndustryType]'))
EXEC sp_executesql @statement = N'CREATE VIEW [View_Purchase_IndustryType]
AS
SELECT     W_IndustryType.Type, C_Purchase.ID, C_Purchase.IndType, C_Purchase.UserID, C_Purchase.Name, 
                      C_Purchase.AddDate
FROM         W_IndustryType INNER JOIN
                      C_Purchase ON W_IndustryType.ID = C_Purchase.IndType

' 

--2
IF NOT EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[Vie_CorpUser]'))
EXEC sp_executesql @statement = N'CREATE VIEW [Vie_CorpUser]
AS
SELECT     U_UserInfo.LoginName, C_CorpInfo.Name AS CorpName, U_UserInfo.UserID, C_CorpInfo.StartDate, C_CorpInfo.EndDate, 
                      U_UserInfo.Verify, U_UserInfo.GradeID
FROM         U_UserInfo INNER JOIN
                      C_CorpInfo ON U_UserInfo.UserID = C_CorpInfo.ID
' 

--3
IF NOT EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[View_U_C_PictureType_Member]'))
EXEC sp_executesql @statement = N'CREATE VIEW [View_U_C_PictureType_Member]
AS
SELECT     U_C_PictureType.CircleID, U_C_PictureType.Name, U_C_PictureType.MemberID, U_C_PictureType.AddDate AS LastDate, 
                      U_C_Member.LoginName, U_C_PictureType.ID
FROM         U_C_PictureType INNER JOIN
                      U_C_Member ON U_C_PictureType.CircleID = U_C_Member.CircleID AND U_C_PictureType.MemberID = U_C_Member.MemberID
' 

--4
IF NOT EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[View_U_C_Discussion_Member]'))
EXEC sp_executesql @statement = N'CREATE VIEW [View_U_C_Discussion_Member]
AS
SELECT     U_C_Discussion.MemberID, U_C_Discussion.Subject, U_C_Discussion.CircleID, U_C_Member.LoginName, 
                      U_C_Discussion.VisitCapacity, U_C_Discussion.TopicID, U_C_Discussion.Picture, U_C_Discussion.PithTopic, 
                      U_C_Discussion.TopTopic, U_C_Discussion.PrivateTopic, U_C_Discussion.WebPith, U_C_Discussion.WebTop, 
                      U_C_Discussion.AddDate, U_C_Discussion.Recommend, U_C_Discussion.Message
FROM         U_C_Discussion INNER JOIN
                      U_C_Member ON U_C_Discussion.MemberID = U_C_Member.MemberID AND U_C_Discussion.CircleID = U_C_Member.CircleID
' 

--5
IF NOT EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[View_Cosultative_CosultativeType]'))
EXEC sp_executesql @statement = N'CREATE VIEW [View_Cosultative_CosultativeType]
AS
SELECT     W_ConsultativeType.Name, W_Consultative.TypeID, W_Consultative.Title, W_Consultative.AddDate, W_Consultative.Origin, 
                      W_Consultative.Picture, W_Consultative.ChangeDirectionLink, W_Consultative.Detail, 
                      W_Consultative.ID, W_Consultative.KeyWord, W_Consultative.Author, W_Consultative.Reading, 
                      W_Consultative.ClickCount
FROM         W_ConsultativeType INNER JOIN
                      W_Consultative ON W_ConsultativeType.ID = W_Consultative.TypeID
' 

--6
IF NOT EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[View_Picture_PictureType_UserInfo]'))
EXEC sp_executesql @statement = N'CREATE VIEW [View_Picture_PictureType_UserInfo]
AS
SELECT     U_C_Picture.ID, U_C_Picture.CircleID, U_C_Picture.MemberID, U_C_Picture.TypeID, U_C_Picture.Picture, 
                      U_C_Picture.Explain, U_C_Picture.AddDate, U_C_PictureType.MemberID AS Expr1, U_UserInfo.LoginName
FROM         U_C_Picture INNER JOIN
                      U_C_PictureType ON U_C_Picture.TypeID = U_C_PictureType.ID INNER JOIN
                      U_UserInfo ON U_C_Picture.MemberID = U_UserInfo.UserID
' 

--7
IF NOT EXISTS (SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[View_SystemLable_SystemLableType]'))
EXEC sp_executesql @statement = N'CREATE VIEW [View_SystemLable_SystemLableType]
AS
SELECT     W_SystemLableType.ID AS LableTypeID, W_SystemLableType.Name AS TypeName, W_SystemLableType.ParentID, 
                      W_SystemLable.ID, W_SystemLable.Name, W_SystemLable.TypeID, W_SystemLable.Info, W_SystemLable.Remarks, 
                      W_SystemLable.Head, W_SystemLable.[Content], W_SystemLable.Footer
FROM         W_SystemLable INNER JOIN
                      W_SystemLableType ON W_SystemLable.TypeID = W_SystemLableType.ID
' 


