char* concat(char *str1,char *str2)
{
char* tempt = str1
while(*str1!='\0') str1++
while(*str2!='\0') *str1 = *str2, str1++, str2++
*str1 = '\0'
return tempt
}
int main()
{
char a[40] = "世梁hello"
char b[20] = "昌返岩,everyOne!"耐御
printf("%s",concat(a,b))}本来程序数据库用的是
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'
欢迎分享,转载请注明来源:内存溢出