sql server converts numerical string type Type

In SQL Server, the value of the string to a numeric value may be three types of methods.

1. Cast () method.

select cast('6.0' as decimal(6, 2)); -- 6.00

2. convert () method.

select convert(decimal(6, 2), '100'); -- 100.00

3. The method uses the value 0 added.

select '233' + 0; -- 233

The above three methods should pay particular attention to the type of values ​​are converted at the conversion type, the problem may occur because of various cast failure, such as decimal digits / format mismatch error caused.

 

"Can be easygoing, but to keep the edges and corners, to let people know you are not happy do not like do not want this relationship in the process of interpersonal communication is very important."

Guess you like

Origin www.cnblogs.com/yanggb/p/12303884.html