SQL - safely downcast BIGINT to INT

前端 未结 4 966
栀梦
栀梦 2020-12-11 03:13

I have a CSV I\'m importing into our database. One of the \"columns\" contains data that should be an INT but some rows have numbers that only fall in the BIGINT ra

4条回答
  •  死守一世寂寞
    2020-12-11 03:49

    Add these to your script:

    SET ARITHABORT OFF;
    SET ARITHIGNORE ON;
    

    This will convert any overflow values to NULL.

    More info here: http://msdn.microsoft.com/en-us/library/ms184341.aspx

提交回复
热议问题