带有IF IS NOT NULL子句的SQL更新语句? [英] SQL update statement with IF IS NOT NULL clause?

查看:130
本文介绍了带有IF IS NOT NULL子句的SQL更新语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙伴们


即时通讯使用经典的asp和sql server 05 - 我的网页表单提交了一个更新语句,结果更新了一个sql表。


我的问题是,有没有办法强制更新语句只能通过使用IF NOT IS NULL函数进行更新?


我的更新声明

展开 | 选择 | Wrap | 行号

解决方案

你能解释一下吗......如果数据存在于哪里?

如果您的意思是数据是从您的网络表单提供的,那么ge代码判断SQL是否可以确定是否进行更新


感谢您的回复 - 对不起,我已经更新了第一篇文章。


但我基本上意味着如果Web表单字段中存在数据,我只想执行sql更新。如果表单字段中没有任何内容,那么我想在sql语句中更新此字段。


这可能吗?


谢谢对于更新,然后是,如果字段为空,那么制定更新语句的代码将省略更新中的相关部分,有点像这样

展开 | 选择 | Wrap | 行号

hi guys

im using classic asp and sql server 05 - and my web form submits an update statement which in result updates a sql table.

my question is, is there a way to force an update statement to only update by making use of the IF NOT IS NULL function?

my update statement

Expand|Select|Wrap|Line Numbers

解决方案

Can you explain a bit more ... if data is present where ?
If you mean if data is supplied from your webform, then the code that generates the SQL is where you would determine whether or not to do the update


thanks for your reply - sorry for confusion, I have updated the first post.

but I basically meant that I only want to perform the sql update if there is data present in the web form fields. if there is nothing in a form field then I want to omit this field from updating in the sql statement.

is this possible?


Thanks for the update, then yes, your code that formulates the update statement would omit the relevant parts from the update if the field is empty, a bit like this

Expand|Select|Wrap|Line Numbers


这篇关于带有IF IS NOT NULL子句的SQL更新语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆