随笔分类 -  数据库相关

摘要:目的: 过滤某个字段中含有空格的数据。比如:字段name中有数据“nick zhang”, “nickZhang”,我想选出“nick zhang”。常见做法:使用charindex()函数:select name from testUser where charindex(‘ ‘, name) > 0;原理:使用charindex()判断当前的name是否包含空格。Code:Create table testUser (name nvarchar(2000));insert into testUser values('nick zhang');insert into t 阅读全文
posted @ 2011-09-02 08:50 TonnyGu 阅读(3201) 评论(0) 推荐(0)
摘要:select (case when num>0 then 'Y' when num=0 then 'NG' else 'N' end) as column from table 阅读全文
posted @ 2011-03-22 13:11 TonnyGu 阅读(13246) 评论(0) 推荐(1)