都试过了,都没有问题
if object_id('stu') is not null drop table stu
go
select cast('2006-1-1' as smalldatetime) as inTime
into stu
union select '2006-1-2'
union select '2006-1-3'
union select '2006-1-4'
union select '2006-1-5'
if object_id('proc_stu') is not null drop procedure proc_stu
go
create procedure proc_stu @myTime varchar(20)
as
select * from stu where inTime>@myTime
go
exec proc_stu '2006-1-3'
/*
inTime
2006-01-04 00:00:00
2006-01-05 00:00:00
*/
drop procedure proc_stu
drop table stu
if object_id('stu') is not null drop table stu
go
select cast('2006-1-1' as smalldatetime) as inTime
into stu
union select '2006-1-2'
union select '2006-1-3'
union select '2006-1-4'
union select '2006-1-5'
if object_id('proc_stu') is not null drop procedure proc_stu
go
create procedure proc_stu @myTime smalldatetime
as
select * from stu where inTime>@myTime
go
exec proc_stu '2006-1-3'
/*
inTime
2006-01-04 00:00:00
2006-01-05 00:00:00
*/
drop procedure proc_stu
drop table stu