In MS SQL Server, the optimizer automatically or implicitely converts a strings to the data type of the parameter, or it converts the data type of the actual value to a string. In ASE, automatic or implicit conversions are only performed for certain data type pairs, such as DateTime
and string
.
Examples
create proc Example (@i int, @n numeric(5,2)) as
select @i, @n
go
exec Example @i = '12', @n = '5.2'
go
drop proc Example
create proc Example (@i varchar(10), @n varchar(10)) as
select @i, @n
go
exec Example @i = 12, @n = 5.2
go
drop proc Example
Note: These implicit type conversions are not restricted to the values of parameters. Assigning values to variables follows the same pattern, as the code fragments below demonstrate.
declare @i int, @n numeric(5,2)
select @i = '12', @n = '5.2'
select @i, @n
go
declare @i varchar(10), @n varchar(10)
select @i = 12, @n = 5.2
select @i, @n
go