分类问题

编号为四字节数,最多四级部门,不允许为0x00000000,
表示方法为:0x01000000 0x02000000,…,0xFF000000为一级部门,
0x01010000为二级部门,其父部门为0x01000000,
0x01010101为四级部门,其对应的三级部门为0x01010100,
怎样查找1级部门 SQL

select * from dept where id%0x01000000=0

 

select * from dept where id%0x00010000=0 and (substring(cast(id as varbinary(255)),0,2) like 0x01) and id%0x01000000<>0

posted on 2008-09-05 13:04  水乐天  阅读(244)  评论(0编辑  收藏  举报

导航