I would cast the dates to a plain date which makes this solution independent of implementation details
select @ID=ID
from info_user
where Name = @Name
and cast (UpdateTime as Date) = Cast(@TestTime as Date)
However, I would either add the date part of the UpdateTime
as an additional (calculated) column or split the information into a date and a time part. This makes it much easier to query entries by the plain date.
As a rule of thumb: The type of columns (in general: the table layout) greatly depends on the type of query you usually run against your data.
Edit: As attila pointed out, the date
datatype only exists in version 2008 and up