无法上传重复值的excel bcoz [英] unable to upload excel bcoz of duplicate values

查看:107
本文介绍了无法上传重复值的excel bcoz的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..

我将数据从excel上传到db中的商店。如果der没有重复值意味着它上传。但是,如果我在DB和Excel中都有相同的数据,那么我拒绝在数据库中使用我的主键的整个excel表bcoz。我想上传其他棕褐色主键字段的所有数据。



示例:

数据库中的数据(这里我设置为numb的主键)



麻木的名字性别



1 shalu fem

2 sugan fem

3 prabha男



Excel中的数据



100 suba fem

101 arun男

2 sugan fem(此行不应上传)

Hi..
I uploaded data from excel to store in db. if der is no repeated values means its getting uploaded. but if i hav same data in both DB and in Excel its rejecting whole excel sheet bcoz of my primary key in database. i want to upload all datas other tan primary key field.

Example:
Datas in Database(here i set primary key for numb)

numb name sex

1 shalu fem
2 sugan fem
3 prabha male

datas in Excel

100 suba fem
101 arun male
2 sugan fem( this row should not upload)

推荐答案

最好你试试检查如果数据库中已存在PK值,则在将数据插入数据库之前的条件然后无需插入,否则它将被插入..



(或)



在DB本身中,您将PK列设置为自动增量列。
Better you try to check the condition before insert the data into DB if the PK value is already exists in DB then no need to insert otherwise it''s inserted..

(or)

In DB itself you set the PK column as Auto increment column.


您好

请描述您的数据结构,哪个字段是您的主键。
Hi
kindly describe your data structure, which field is your primary key.


这篇关于无法上传重复值的excel bcoz的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆