摘要: use mydatabaseselect * from table1 where username like'%c%"下面是完成上面功能的另一种写法:use mydatabaseselect * from table1 where charindex('c',username)>0这种方法理论上比上一种方法多了一个判断语句,即>0, 但这个判断过程是最快的, 我想信80%以上的运算都是花在查找字符串及其它的运算上, 所以运用charindex函数也没什么大不了. 用这种方法也有好处, 那就是对%,|等在不能直接用like查找到的字符中可以直接在这c 阅读全文
posted @ 2011-12-28 16:58 _cc 阅读(220) 评论(0) 推荐(0) 编辑
摘要: declare @alive bit;set @alive = null;if @alive = 1 or @alive != 1 print 'Alive or Dead';else print 'Huh? Neither alive nor dead'; if @alive=@alive PRINT 'It must equal itself, right?'ELSE PRINT 'Not always. null does not equal null';代码挺有意思的,并且把NULL是什么解释的很清楚,写供大家参考一下。 阅读全文
posted @ 2011-12-28 16:05 _cc 阅读(188) 评论(0) 推荐(0) 编辑