亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

mysql函數中concat在sqlserver函數中怎么用?

mysql函數中concat在sqlserver函數中怎么用?

米琪卡哇伊 2018-11-22 23:19:04
mysql函數中concat在sqlserver函數中怎么用
查看完整描述

1 回答

?
慕無忌1623718

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

查看完整回答
反對 回復 2018-12-16
  • 1 回答
  • 0 關注
  • 1371 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號