怎么写isnull ......? [英] how to write isnull...?

查看:75
本文介绍了怎么写isnull ......?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新tbl_fs_mst set d_date_from = isnull(SELECT MAX(D_DATE_REPORT)FROM TBL_DWR WHERE C_FS_Code = @ oldfscode),'2015/02/01')



但iam得到错误





Plz告诉我如何使用isnull函数..

update tbl_fs_mst set d_date_from=isnull(SELECT MAX(D_DATE_REPORT) FROM TBL_DWR WHERE C_FS_Code=@oldfscode),'2015/02/01')

but iam getting error


Plz tell me how to use isnull function..

推荐答案

不确定您是否尝试更新具有NULL值的行,但可能类似于:

Not sure if you're trying to update rows having NULL values but perhaps something like:
update tbl_fs_mst 
set d_date_from=(SELECT ISNULL(MAX(D_DATE_REPORT),'2015/02/01') 
                 FROM TBL_DWR 
                 WHERE C_FS_Code=@oldfscode)
WHERE date_from IS NULL






试试这个...



Hi,

Try this...

update tbl_fs_mst set d_date_from=SELECT ISNULL(MAX(D_DATE_REPORT),'2015/02/01') FROM TBL_DWR WHERE C_FS_Code=@oldfscode







希望这会对你有所帮助。



干杯




Hope this will help you.

Cheers






我发现你的给定查询包含语法错误..



Hi ,

I found that your given query contains syntax error..

update tbl_fs_mst set d_date_from=isnull(SELECT MAX(D_DATE_REPORT) FROM TBL_DWR WHERE C_FS_Code=@oldfscode),'2015/02/01')





您在查询中错过了括号,因此更正的查询是..





you missed parenthesis in your query , so the corrected query is..

update tbl_fs_mst set d_date_from=isnull((SELECT MAX(D_DATE_REPORT) FROM TBL_DWR WHERE C_FS_Code=@oldfscode),'2015/02/01')





试试吧......





谢谢

Magesh M



just try this...


Thanks
Magesh M


这篇关于怎么写isnull ......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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