.net - How to set column value in SQL select statement? -
i want set 1 column value in rows "0"
sqlcommand cmd = m_objdbcapex.getsqlcommand(commandtype.text); cmd.commandtext = "select capex_billofmaterialitem.* capex_billofmaterialitem,capex_billofmaterial capex_billofmaterialitem.szbillofmaterialid = capex_billofmaterial.szbillofmaterialid , capex_billofmaterial.szprojectcode = '" + szprojectcode + "'"; da = new sqldataadapter(cmd); da.fill(dtdat);
adding point @rahul's answer.
if field has specific values , if want alone make 0 need case statements.
select case when capex_billofmaterialitem.fieldname = 'checking value goes here' 0 else capex_billofmaterialitem.fieldname end fieldname1, capex_billofmaterialitem.* capex_billofmaterialitem, capex_billofmaterial capex_billofmaterialitem.szbillofmaterialid = capex_billofmaterial.szbillofmaterialid , capex_billofmaterial.szprojectcode = '" + szprojectcode + "'
Comments
Post a Comment