我试图从varchar字段中删除一个空格和一个不间断的空间我将要转换为int,但是,当使用replace方法时,SQL Management Studio在接受它后会弄乱语法,所以我可以保存它。这是我的疑问:
SELECT SZOMSCHRIJVING
FROM dbo.BETONKWALITEITEN AS b
WHERE (iBetonMengsel = CAST(REPLACE(p.SZBETONRECEPT, ' ', '') as INT))
接受此语法后,SQL Management Studio将其转换为以下代码:
SELECT SZOMSCHRIJVING
FROM dbo.BETONKWALITEITEN AS b
WHERE (iBetonMengsel = CAST(REPLACE('p.SZBETONRECEPT. . ',,) AS INT))
如何从此列替换空格和不间断空格?
答案 0 :(得分:0)
尝试将char值32替换为空格,将160替换为不间断空间:
...
->with([
'userProfile' => function ($query) use ($dbConnectionName) {
$query->from('[yourdatabase].[dbtable]')->select('id','user_code', 'mobile', 'name', 'profile_pic_url');
}
...