在SQL Server中添加外键约束的问题?(Issues with adding foreign key constraint in SQL Server?)
我正在使用SQL Server,我需要将一个外键添加到现有的表中。
问题是作为外键的列已经在另一个表中具有一些不一致的值(不作为主键出现)。
我想知道,当我改变表并添加外键约束时,具有外键约束的表中的行会发生什么,它具有不一致的值?
--Neeraj
I am using SQL Server, and I need to add a foreign key to an already existing table.
The issue is the column which will act as the foreign key already has a few inconsistent values (which do not occur as a primary key) in another table.
I was wondering, when I alter the table and add the foreign key constraint, what will happen to the rows in the table with foreign key constraint , which has inconsistent values??
--Neeraj
原文:https://stackoverflow.com/questions/5740339
最满意答案
请理解Javascript是客户端代码,PHP是服务器端代码。
您可以实现两种可能的方式或方案:
如果您想在将JS文件发送到客户端之前对其进行操作,则可以将Javascript文件重命名为.php扩展名并编写php代码以提供变量。 对于Ex:
<?php // write php code to create a string of values using a for loop $price_array_string = "'$ 16.95','$ 30.95','$ 49.95', '$ 70.95','$ 99.95','$ 109.95','$ 139.95','$ 155.95','$ 199.95','$ 460.95'"; // Javscript Code var price_arr = new Array(`<?`php echo $price_array_string ?>);
另一种方法是通过向PHP Web服务发出Ajax请求来获得price数组的值。
Please understand that Javascript is Client Side code and PHP is server side code.
There can be 2 possible ways or scenarios which you want to achieve:
If you want to manipulate the JS file before sending it to client, you can rename the Javascript file to have .php extension and write php code to provide a variable. For Ex:
<?php // write php code to create a string of values using a for loop $price_array_string = "'$ 16.95','$ 30.95','$ 49.95', '$ 70.95','$ 99.95','$ 109.95','$ 139.95','$ 155.95','$ 199.95','$ 460.95'"; // Javscript Code var price_arr = new Array(`<?`php echo $price_array_string ?>);
The other alternative is that you get the value of price array by making an Ajax Request to a PHP web service.
相关问答
更多-
您没有被重定向,因为PHP重定向在作为AJAX调用运行时不会影响浏览器。 您需要在success函数中指定JavaScript重定向: $.ajax({ type: 'post', url: 'update.php', data: { source1: "some text", }, success: function( data ) { document.location.href = 'update.php' } }); ...
-
PHP中的Javascript变量(Javascript variable in PHP)[2023-06-27]
您正在混合服务器端脚本和浏览器端脚本 $ variable dissapears在浏览器端,因此它将始终保存“document.write(variable);” 无论里面的脚本是什么写的。 但是,您可以使用AJAX将数据发送回php并在那里处理它。 You are mixing Server-side scripting along with browser-side scripting $variable dissapears on the browser-side and so it will alw ... -
你在这做什么应该已经做你想做的事。 更改选择框时,将使用选择框的当前选定值调用showData函数:
-
我认为$ _GET ['e']在原始脚本中不起作用,因为它没有从表单页面传递给该处理脚本。 我访问了您提供的URL( http://www.rockaholics-cologne.de/root/signup.php?e=cataras@gmx.de )。 请注意,当您提交表单时,URL中的“e”值不会传递给处理脚本的任何内容。 在您的表单中,您需要执行以下操作:这条线 url: 'jquery.php?query='.alertNumber, 应该 url: 'jquery.php?query='+alertNumber, This line url: 'jquery.php?query='.alertNumber, Should be url: 'jquery.php?query='+alertNumber,
尝试刷新分配给PHP变量的JavaScript变量(Trying to refresh JavaScript variable that is assigned to a PHP variable)[2023-11-19]
是的 - 这不会像你所知的那样奏效。 setInterval(function() { var buyprice = price($coin2[1] , 'buy'); ?>; var sellprice = price($coin2[1] , 'sell'); ?>; $('#currentbuyprice').html(buyprice); $('#currentsellp ...请理解Javascript是客户端代码,PHP是服务器端代码。 您可以实现两种可能的方式或方案: 如果您想在将JS文件发送到客户端之前对其进行操作,则可以将Javascript文件重命名为.php扩展名并编写php代码以提供变量。 对于Ex:从评论我认为我明白你想要的: var ajax = new XMLHttpRequest(); function getValues(callback) { ajax.abort(); ajax.open("GET", "index.php?showme=1", true); ajax.send(); ajax.onreadystatechange = function() { if (ajax.readyState == 4 && ajax.statu ...window.setInterval(function(){ jQuery.ajax({ url:'/xmlparse.php' }).done(function(response) { resultvalue=response; }); },5000); 您可能需要解析结果。 也许xmlparse应该使用json_encode对其进行格式化,以便您的ajax请求可以将其作为对象获取。 编辑:查看您的源代码,我发现径向仪表实际上并不监视result ...没有ajax? 好, var img = new Image(); img.src = "script.php?myVal=" + encodeURIComponent(theValueToPass); 浏览器将尝试通过请求URL来加载图像。 显然这将是一个愚蠢的差事,但你的PHP脚本将被执行和PHP的$_GET['myVal']可用的值 No ajax? ok, var img = new Image(); img.src = "script.php?myVal=" + encodeURICompone ...相关文章
更多- SQL Server 压力测试
- mysql删除外键(Cannot drop index 'FK7D676EBBD0A6D8FD': needed in a foreign key constraint)
- Hadoop+SQL Server+Excel=大数据分析
- SQL Server 2000 如何锁定表中的行,使其他线程读取该行时候发生sql异常,不能读取?
- 锋利的SQL
- 一个sql查询
- 关于mysql 的 sql
- 请教一个SQL实现
- sql 语句
- sql问题
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)