我正在使用 DeZign for Databased v6 来设计我的 sql 数据库。
它一直运行良好,直到这个当前视图 SQL 代码:
CREATE VIEW %viewname%
AS
SELECT dbo.tblSiteChallengeMember.id, tblSiteMemberDetail_2.memberNickname AS mediator, dbo.tblSiteGame.name AS gameName,
tblSiteMemberDetail_1.memberNickname AS teamMemberName, dbo.tblSiteChallengeMemberTeam.accepted, dbo.tblSiteChallengeMemberTeam.teamNumber,
dbo.tblSiteChallengeMember.matchDate, dbo.tblSiteChallengeMember.dateAdded, dbo.tblSiteChallengeMember.completed,
dbo.tblSiteMemberDetail.memberNickname AS creatorName, dbo.tblSiteChallengeMediator.refferalCount,
dbo.tblSiteChallengeMediator.dateAdded AS mediatorJoinDate
FROM dbo.tblSiteChallengeMemberWin RIGHT OUTER JOIN
dbo.tblSiteChallengeMember INNER JOIN
dbo.tblSiteMemberDetail ON dbo.tblSiteChallengeMember.creatorId = dbo.tblSiteMemberDetail.id ON
dbo.tblSiteChallengeMemberWin.challengeId = dbo.tblSiteChallengeMember.id LEFT OUTER JOIN
dbo.tblSiteMemberDetail AS tblSiteMemberDetail_1 INNER JOIN
dbo.tblSiteChallengeMemberTeam ON tblSiteMemberDetail_1.id = dbo.tblSiteChallengeMemberTeam.memberId ON
dbo.tblSiteChallengeMember.id = dbo.tblSiteChallengeMemberTeam.challengeId RIGHT OUTER JOIN
dbo.tblSiteGame ON dbo.tblSiteChallengeMember.gameId = dbo.tblSiteGame.id LEFT OUTER JOIN
dbo.tblSiteMemberDetail AS tblSiteMemberDetail_2 INNER JOIN
dbo.tblSiteChallengeMediator ON tblSiteMemberDetail_2.id = dbo.tblSiteChallengeMediator.memberId ONCREATE VIEW %viewname%
AS
SELECT dbo.tblSiteChallengeMember.id, tblSiteMemberDetail_2.memberNickname AS mediator, dbo.tblSiteGame.name AS gameName,
tblSiteMemberDetail_1.memberNickname AS teamMemberName, dbo.tblSiteChallengeMemberTeam.accepted, dbo.tblSiteChallengeMemberTeam.teamNumber,
dbo.tblSiteChallengeMember.matchDate, dbo.tblSiteChallengeMember.dateAdded, dbo.tblSiteChallengeMember.completed,
dbo.tblSiteMemberDetail.memberNickname AS creatorName, dbo.tblSiteChallengeMediator.refferalCount,
dbo.tblSiteChallengeMediator.dateAdded AS mediatorJoinDate
FROM dbo.tblSiteChallengeMemberWin RIGHT OUTER JOIN
dbo.tblSiteChallengeMember INNER JOIN
dbo.tblSiteMemberDetail ON dbo.tblSiteChallengeMember.creatorId = dbo.tblSiteMemberDetail.id ON
dbo.tblSiteChallengeMemberWin.challengeId = dbo.tblSiteChallengeMember.id LEFT OUTER JOIN
dbo.tblSiteMemberDetail AS tblSiteMemberDetail_1 INNER JOIN
dbo.tblSiteChallengeMemberTeam ON tblSiteMemberDetail_1.id = dbo.tblSiteChallengeMemberTeam.memberId ON
dbo.tblSiteChallengeMember.id = dbo.tblSiteChallengeMemberTeam.challengeId RIGHT OUTER JOIN
dbo.tblSiteGame ON dbo.tblSiteChallengeMember.gameId = dbo.tblSiteGame.id LEFT OUTER JOIN
dbo.tblSiteMemberDetail AS tblSiteMemberDetail_2 INNER JOIN
dbo.tblSiteChallengeMediator ON tblSiteMemberDetail_2.id = dbo.tblSiteChallengeMediator.memberId ON
dbo.tblSiteChallengeMember.mediatorId = dbo.tblSiteChallengeMediator.id
这会引发 SQL 错误:
Msg 102, Level 15, State 1, Procedure vwGetChallengeDetails, Line 19
Incorrect syntax near 'ONCREATE'.
我对数据库仍然很陌生,但我从未见过 ONCREATE 命令(代码中的 AS 上方)。有人可以检查一下并告诉我有什么问题吗?