SQL中replace函数

string sql1 = "select price from dbo.eazy_farm where REPLACE(title,' ','')='" + cainame + "' and company_id='" + company_id.ToString() + "'";

replace第一个参数为数据库字段名

          第二个参数为被替换的字符

          第三个参数为需要替换成的字符

上面sql语句的意思是需要把title中的所有空格去掉然后和cainame比较

posted @ 2016-11-09 11:07  雅比斯  阅读(1342)  评论(0编辑  收藏  举报