SELECT * 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 '没有找到匹配的数据'
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
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 @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
上面的打开方式有点忘了,自己查一下!