在多列上级联外键

时间:2016-08-05 09:14:38

标签: sql-server foreign-keys

我正在尝试使用以下脚本创建UPDATE CASCADE对表的外键引用。我收到错误,说它可能导致循环或多个级联路径。

<!DOCTYPE html>
<html lang="en">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<body>

<div ng-app="myApp" ng-controller="formCtrl">
  <form id="someForm" name="someForm">
    First Name: <input type="text" id="fname" ng-model="user.firstname" ng-model-options="{updateOn: 'change'}" />
    Last Name:  <input type="text" id="lname" ng-model="user.lastname" ng-model-options="{updateOn: 'change'}" />
   <input id="getUser" type="submit" ng-click="getUserName(user)" value="Get User" />
   <button ng-click="resetForm(user)">RESET</button>
  </form>
</div>
<script>
$('#getUser').on('click', function(){
  //$("getUser").on('click', function(){
     //alert("First Name "+$("#fname").val());
     $("#lname").val($("#fname").val());
     alert("Last Name set to "+$("#lname").val());
 // });
});

</script>
<script>
//angular.element(document).ready(function () {});
var app = angular.module('myApp', []);
app.controller('formCtrl', function($scope) {

$scope.getUserName = function(user)
{

     alert("Last Name in Angular Controller: "+$scope.user.lastname)     

}
$scope.resetForm = function(user) {
      //Even when you use form = {} it does not work
      angular.copy({},user);
    }
});

</script>

</body>
</html>

但是当我使用以下脚本创建时,它已成功创建。但我仍然无法更新员工ID。

  ALTER TABLE STA_STATIONARY_REQUEST_MASTER  WITH CHECK ADD CONSTRAINT [FK_STA_STATIONARY_REQUEST_MASTER_REQUESTOR_ID] FOREIGN KEY([REQUESTOR_ID])
    REFERENCES STA_EMPLOYEE_MASTER ([EMPLOYEE_ID])

 ALTER TABLE STA_STATIONARY_REQUEST_MASTER  WITH CHECK ADD CONSTRAINT [FK_STA_STATIONARY_REQUEST_MASTER_CREATED_BY] FOREIGN KEY([CREATED_BY])
REFERENCES STA_EMPLOYEE_MASTER ([EMPLOYEE_ID])

请帮忙。

0 个答案:

没有答案