Changing the datatype from varchar to int issue in SQL Server

0

I simply imported ~900K rows data from CSV file to SQL Server. I was getting some "Error 0xc02020a1: Data Flow Task 1:" one by one for while running the import wizard, so post doing some google I just increased the (50) to (200) for each column.

However, good thing that full data has been loaded, however the issue is Years, Amount etc. columns are in varchar and I tried to write alter table [LargeTable] alter column [Year] int; But error msg came --> Conversion failed when converting the varchar value '"2018"' to data type int. The statement has been terminated.

Now, I get the results if I write like below (just for testing):

SELECT [Folio], [Land Use] FROM [LargeTable] WHERE [Year]='"2018"';

Can you please assist me to fix this issue so that Numeric should be in numeric format.

FYI, I also tried ALTER query by following this post

csv
sql-server
sql
import
ssms
asked on Super User Apr 17, 2019 by HelloWorld024 • edited Apr 17, 2019 by HelloWorld024

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0