select * from A where cast(ima as varbinary) like '%BBBFB%'
不对啊。查不出来我的是SQLSERVER2005
select * from A where PATINDEX('%BBBFB%',ima)>0
select * from A where SUBSTRING(ima,1,8000) like '%BBBFB%'
如果你语句没错的话,试试这样写,我前天也遇到过和你相似的情况'select * from (select top '+ Cast(@num1 as nvarchar(100)) + ' percent * from test where testCourse=''ccjxtjc'' order by newid())a union all select * from (select top '+ Cast(@num2 as nvarchar(100)) + ' percent * from test where testCourse=''dyjxl'' order by newid())b union all select * from (select top '+ Cast(@num3 as nvarchar(100)) + ' percent * from test where testCourse=''qtks'' order by newid())c union all select * from (select top '+ Cast(@num4 as nvarchar(100)) + ' percent * from test where testCourse=''rjbf'' order by newid())d union all select * from (select top '+ Cast(@num5 as nvarchar(100)) + ' percent * from test where testCourse=''smyxl'' order by newid())e union all select * from (select top '+ Cast(@num6 as nvarchar(100)) + ' percent * from test where testCourse=''yjwxjs'' order by newid())f)h'
select * from (select top '+ Cast(@num2 as nvarchar(100)) + ' percent * from test where testCourse=''dyjxl'' order by newid())b union all
select * from (select top '+ Cast(@num3 as nvarchar(100)) + ' percent * from test where testCourse=''qtks'' order by newid())c union all
select * from (select top '+ Cast(@num4 as nvarchar(100)) + ' percent * from test where testCourse=''rjbf'' order by newid())d union all
select * from (select top '+ Cast(@num5 as nvarchar(100)) + ' percent * from test where testCourse=''smyxl'' order by newid())e union all
select * from (select top '+ Cast(@num6 as nvarchar(100)) + ' percent * from test where testCourse=''yjwxjs'' order by newid())f)h'