关于向数据库中插入数据时报"An explicit value for the identity column in table 'tm_o365_11' can only be specified when a column list is used and IDENTITY_INSERT is ON."错误
解决方法
从网上搜索说是如果想显示插入自增列(此表中的自增列是ID)需要将IDENTITY_INSERT设为ON。
于是在python脚本中添加这句话,代码如下。ps:我这里插入的表是随机的
def hash_id(company_id):
num = company_id[35:]
return int(num, 16)%16
sql1 = "select distinct company_id from tm_o365_x"
cur.execute(sql1)
data_list =