declare @string varchar(4000)
set @string = '?'
declare @i int ,@flag int
select @i=1,@flag=0
while @flag=0
begin
if @i>(select len(yourcolumn) from opendatesource('sqloledb','yourfile,uid id=admin;pwd=',)...yourtable where 条件)
begin
set @flag=-1
print 'no'
end
if (select substring(yourcolumn,@i,1) from opendatesource('sqloledb','yourfile,uid id=admin;pwd=',)...yourtable where 条件)=substring(@string,@i,1)
begin
set @flag=1
print 'yes'
end
end
上面的打开方式有点忘了,自己查一下!
set @string = '?'
declare @i int ,@flag int
select @i=1,@flag=0
while @flag=0
begin
if @i>(select len(yourcolumn) from opendatesource('sqloledb','yourfile,uid id=admin;pwd=',)...yourtable where 条件)
begin
set @flag=-1
print 'no'
end
if (select substring(yourcolumn,@i,1) from opendatesource('sqloledb','yourfile,uid id=admin;pwd=',)...yourtable where 条件)=substring(@string,@i,1)
begin
set @flag=1
print 'yes'
end
end
上面的打开方式有点忘了,自己查一下!
set @string = '?'
declare @i int ,@flag int
select @i=1,@flag=0
while @flag=0
begin
if @i>(select len(yourcolumn) from opendatesource('sqloledb','yourfile,uid id=admin;pwd=',)...yourtable where 条件)
begin
set @flag=-1
print 'no'
end
else if (select substring(yourcolumn,@i,1) from opendatesource('sqloledb','yourfile,uid id=admin;pwd=',)...yourtable where 条件)=substring(@string,@i,1)
begin
set @flag=1
print 'yes'
end
end
上面的打开方式有点忘了,自己查一下!
declare @a varbinary
set @a=11111111if exists(select * from tableName where convert(int,@a&columnName)>0)
print '匹配成功'
else
print '没有找到匹配的数据'
set @a=11111111
if convert(decimal(10,0),@a&10010001)>0
print '匹配成功'
else
print '没有找到匹配的数据'
select @a=colname from yourtable
if cast(@a as varbinary) and 100000 <>0
print '匹配成功'
else
print '没有找到匹配的数据'
先读到sqlserverSELECT * into 新建表的名称
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\Finance\account.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...xactions --Excel表单名称然后:
declare @a varbinary
set @a=10000000 --选择要匹配的数据
if exists(select * from 新建表的名称 where convert(int,@a&保存0和1的列)>0)
print '匹配成功'
else
print '没有找到匹配的数据'
set @a=10000000 --选择要匹配的数据
if exists(SELECT *
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\Finance\account.xls";User ID=Admin;Password=;Extended properties=Excel 5.0')...xactions where convert(int,@a&保存0和1的列)>0)
print '匹配成功'
else
print '没有找到匹配的数据'
select @a='10',@b='100010'if (cast(@a as bigint) & cast(@b as bigint))>0
print 'ok'
else
print 'no'