title: SQL 'ONCREATE' command
body: <p>I am using DeZign for Databased v6 to design my sql database.</p>
  
  <p>It has worked perfectly, up until this current view SQL code:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Which throws a SQL error:</p>
  
  <pre><code>Msg 102, Level 15, State 1, Procedure vwGetChallengeDetails, Line 19
  Incorrect syntax near 'ONCREATE'.
  </code></pre>
  
  <p>I am still fairly new to databasing, but I have never seen the ONCREATE command (<strong>above AS in the code</strong>). Could someone please check this and tell me what's wrong?</p>