/****** Object: StoredProcedure [dbo].[getSplitValue] Script Date: 03/13/2014 13:58:12 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[getSplitValue] AS --定义获取GUID ) SET @NEWID= REPLACE(NEWID(),'-','') --判断临时表数据是否存在,如果
当一个字段想模糊查询出多个字段的时候,正常情况下一般会这么作 select * from a where name like 'a%' or name like 'b%' ....or ...; 但是上面的情况只能对应少量的模糊查询值,过多之后再后台开发的时候会出现非常麻烦的sql语句拼接 这时我们可以采用正则表达式进行匹配 select * from a where name regexp'a|b|...'; 如果各位大神有更好的方法,请在下面留言!
例如student表: studentID studentName studentScore 01 Alice 90 02 Bill 95 03 Cindy 100 一.拼接多个字段的值 select studentID+‘-’+studentName+'-'+studentScore AS studentInfo from student 结果: 二.一个字段多条记录的拼接 select stuff((select '|'+studentName from student for xm
//在两个数成对出现的数组中找到一个单独的数.比如{1,2,3.3,1,4.2},即找出4 #include <stdio.h> int find(int arr[], int len) { int i = 0; int ret = 0; for (i = 0; i < len; i++) { ret = ret^arr[i]; } return ret; } int main() { int arr1[] = { 1, 2, 2, 3, 1, 5, 3 }; int arr2[] =