Converting SQL SERVER string type varchar format an int sort

Routine data analysis process, often encounter the sort of situation, sometimes temporarily sorted empty field in the table, data type conversion

Using ORDER BY CAST (<field name> AS INT) ASC

For example:

SELECT IBM,CMC FROM YXHIS..TBZDBQ ORDER BY CAST (CWBM AS INT) ASC

Guess you like

Origin www.cnblogs.com/since-1995/p/11070383.html