Click here to Skip to main content
15,896,348 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
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..
Posted

Not sure if you're trying to update rows having NULL values but perhaps something like:
SQL
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
 
Share this answer
 
Hi,

Try this...

SQL
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
 
Share this answer
 
Hi ,

I found that your given query contains syntax error..

SQL
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..

SQL
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')


just try this...


Thanks
Magesh M
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900