I have a query where I'm inserting a bunch of records from a table on varchars (imported from a text file) into a table with correct smallint/int fields along with some other conversions and after 2.5 hours it's giving the error:
The conversion of the varchar value '34474' overflowed an INT2 column. Use a larger integer column.
My query is:
Code:
Insert Into [dbo].[GeoFullDemos]
Select [Zip9]
      ,SubString([Zip9], 1, 5) As [Zip5]
      ,SubString([Zip9], 6, 4) As [Zip4]
      ,Cast([LAT] As Float) As [Latitude]
      ,Cast([LON] As Float) As [Longitude]
      ,Cast([BLOCK] As VarChar(15)) As [CensusBlock]
      ,Cast([BLKGRP] As VarChar(15)) As [BlockGroup]
      ,Cast([STUSAB] As Char(2)) As [StateAbbr]
      ,Cast([STATE_FIPS] As Char(10)) As [StateFips]
      ,Cast([STNAME] As VarChar(20)) As [StateName]
      ,Cast([COUNTY_FIPS] As Char(5)) As [CountyFips]
      ,Cast([CNTYNAM] As Char(5)) As [CountyName]
      ,Cast([MACODE] As VarChar(30)) As [MACode]
      ,Cast([MANAME] As VarChar(40)) As [MAName]
      ,Cast([PONAME] As VarChar(25)) As [POName]
      ,Cast([CITYNAME] As VarChar(30)) As [CityName]
      ,Cast([CITY_FIPS] As VarChar(30)) As [CityFips]
      ,Cast([CBSANAME] As VarChar(45)) As [CBSAName]
      ,Cast([CBSACODE] As VarChar(5)) As [CBSACode]
      ,Cast([CBSATYPE] As VarChar(1)) As [CBSATypeCode]
      ,Cast([AREACODE] As Char(3)) As [AreaCode]
      ,Cast([ACSTTPOP0] As VarChar(5)) As [AgeTotal]
      ,[ImportProcessing].[GetAgeCode]([ACSAGE4Y0],[ACSAGE59],[ACSAGE1014],[ACSAGE1519],[ACSAGE2024],[ACSAGE34Y0],[ACSAGE44Y0],[ACSAGE54Y0],[ACSAGE64Y0],[ACSAGE65Y0]) As [AgeCode]
      ,Case When IsNull(Try_Cast([ACSAGE17Y0] As SmallInt), 0) > = 100 Then 'Y' Else 'N' End As [Under18Present]
      ,[ImportProcessing].[GetMaritalStatusCode]([NEVMAR0],[MARRIED0],[WIDOW0],[DIVORC0]) As [MaritalStatusCode]
      ,[ImportProcessing].[GetRaceTypeCode]([WHITE0],[BLACK0],[AMIND0],[ASIAN0],[HAWAII0],[OTHRACE0],[TWORACES0],[HISPAN0],[WHNOHSP0]) As [RaceCode]
      ,[ImportProcessing].[GetHouseholdTypeCode]([MARKID0],[MKID0],[FKID0],[NOFMHH0],[SINGLE0]) As [HouseholdTypeCode]
      ,[ImportProcessing].[EducationLevelCode]([TT8GR0],[TT12GR0],[TTHS0],[TTSMCOL0],[TTASSOC0],[TTBACH0],[TTGRAD0]) As [EducationLevelCode]
      ,[ImportProcessing].[GetMaleArmedForcesCode]([MARMFRC0],[MEMPLOY0],[MUNEMPL0],[MNOWORK0]) As [MaleArmedForcesCode]
      ,[ImportProcessing].[GetFemaleArmedForcesCode]([FARMFRC0],[FEMPLOY0],[FUNEMPL0],[FNOWORK0]) As [FemaleArmedForcesCode]
      ,[ImportProcessing].[GetIncomeLevelCode]([INC10HH0],[INC15HH0],[INC20HH0],[INC25HH0],[INC30HH0],[INC35HH0],[INC40HH0],[INC45HH0],[INC50HH0],[INC60HH0],[INC75HH0],[INC100HH0],[INC125HH0],[INC150HH0],[INC200HH0],[INC201HH0]) As [IncomeLevelCode]
      ,IsNull(Try_Cast([MEDHHIN0] As Int), 0) As [MedianHHIncome]
      ,IsNull(Try_Cast([AGGHHIN0] As Int), 0) As [AggregateHHIncome]
      ,IsNull(Try_Cast([PCAPIN0] As Int), 0) As [PerCapitaIncome]
      ,IsNull(Try_Cast([MDFAMIN0] As Int), 0) As [MedianFamilyIncome]
      ,IsNull(Try_Cast([ACSTOTHU] As SmallInt), 0) As [TotalHousingUnits]
      ,[ImportProcessing].[GetHomeOccupiedCode]([ACSOWOCHU0],[ACSRNOCHU0]) As [HomeOccupiedCode]
      ,IsNull(Try_Cast([ACSAVGHHSZ] As Decimal(5,2)), 0.00) As [AverageHouseholdSize]
      ,[ImportProcessing].[GetUnitsInStructureCode]([UNIT1D0],[UNIT1AT0],[UNIT4S0],[UNIT19S0],[UNIT20S0]) As [UnitsInStructureCode]
      ,IsNull(Try_Cast([MDYRBLT0] As SmallInt), 0) As [MedianYearBuilt]
      ,[ImportProcessing].[GetHomeValueCode]([H30VAL0],[H60VAL0],[H100VAL0],[H200VAL0],[H300VAL0],[H500VAL0],[H501VAL0]) As [HomeValueCode]
      ,IsNull(Try_Cast([MEDVALO0] As Int), 0) As [MedianValueOwnerOccupiedHousing]
      ,[ImportProcessing].[GetRentAmountCode]([NORENT0],[G200RNT0],[G300RNT0],[G500RNT0],[G750RNT0],[G1000RNT0],[G1001RNT0]) As [RentAmountCode]
From [ImportProcessing].[GeoFullDemoStaging];
Is there a way to find out what column it's throwing this error on? I'm not finding anything in the Sql Logs which is where I was hoping it would be logged.

Also I've tried commenting out each of the columns individually and it runs fine, but then doesn't when all of the columns are in the query, which has me wondering what the server is even doing when it's running the full thing.