Thursday 23 July 2015

How to convert varchar data type column to int in SQL Server while querying?

How to convert varchar data type column to int in SQL Server while querying?

There are two ways to convert varchar data type column to int while writing query statements.
  1. CAST
  2. CONVERT
Examples :

CONVERT(int,discountfee)
CAST(discountfee as int)

Here discountfee is column name and int declared as data type for column varchar data type discountfee.

No comments:

Post a Comment