2008-7-1 18:20
bigholy
SQL查询参数怪异问题
执行以下步骤后:
create table demo
( t1 int not null default 0)
-- execute 5 times
insert into demo
select 0
--
set statistics profile on
select * from demo where t1 = ''
set statistics profile off
返回的结果如下:
0
0
0
0
0
5 1 SELECT * FROM [demo] WHERE [t1]=@1 14
5 1 |--Table Scan(OBJECT:([Northwind].[dbo].[demo]), WHERE:([demo].[t1]=Convert([@1]))) 14
为何在条件语句中指定了t1='',也能返回结果,请问是哪里出了错误?
请大家帮分析一下,谢谢!