Reputation: 37
I want to insert NVARCHAR(255)
value which is a decimal value (115.11) from one table in a BIGINT
field of another table.
I also should be using a formula like (Column1 * 100) before I insert in the BIGINT
Field.
SELECT CAST(Column1 AS BIGINT)
FROM Table1
WHERE ISNUMERIC(Column1) = 1
The above query still shows conversion error.
Any help is greatly appreciated. Thanks.
Upvotes: 1
Views: 611
Reputation: 3575
SELECT CAST (CAST (NVarCharCol AS decimal(9,2)) * 100 AS BIGINT) from YourTable where ISNUMERIC(NVarCharCol)=1
Upvotes: 0
Reputation: 2729
This multiplicand for 100
SELECT CAST(CAST (Column1 AS FLOAT)*100 AS BIGINT) from Table1 where ISNUMERIC(Column1)=1
this truncating the decimals
SELECT CAST(CAST (Column1 AS FLOAT) AS BIGINT) from Table1 where ISNUMERIC(Column1)=1
Upvotes: 2