1 回答

TA貢獻1744條經驗 獲得超4個贊
本來程序數據庫用的是mysql,后來轉為sql server2005,
其中一個sql為:
select * from dbo.sys_person_info t where t.VALID_FLAG>0
and t.dept_id in(select a.dept_code from sys_dept a,sys_dept b
where a.sort_no like concat(b.sort_no,'%') and b.dept_code ='37010001'
)
程序報錯:說concat函數不是內置的函數,原來是sql server沒有concat這個函數,把代碼做了一下修改
代替了concat函數,希望對大家有所幫助:
select * from dbo.sys_person_info t where t.VALID_FLAG>0
and t.dept_id in(select a.dept_code from sys_dept a,sys_dept b
where a.sort_no like b.sort_no + ''+'%' and b.dept_code ='37010001'
)
在oracle里的用法(沒有測試):
select * from dbo.sys_person_info t where t.VALID_FLAG>0
and t.dept_id in(select a.dept_code from sys_dept a,sys_dept b
where a.sort_no like b.sort_no || ''|| '%' and b.dept_code ='37010001'
)
添加回答
舉報