如何在数据库表中插入唯一记录? [英] How to insert unique records in database table?

查看:210
本文介绍了如何在数据库表中插入唯一记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我创建了一个Web服务,该服务从Ms-Access获取数据并将数据保存到sql server 2005中. 现在的问题是如何获取那些已更新或新插入的记录

谢谢
Seema

Hi,
I created a webservice that is fetching data from Ms-Access and saved data into sql server 2005.
Now Problem is how to fetch those records which are either updated or new inserting

Thanx
Seema

推荐答案

我认为通过网络服务从Ms Access获取数据时,您的数据应该包含pk值.

我的操作方式(针对类似情况)如下所示:

1.首先从数据中收集所有pk值(通过Web服务来),然后执行删除查询"以删除具有匹配pk的现有数据.

2.插入所有来自Web服务的数据,因为现在其中没有任何重复的数据.
I think there should be pk values with your data while fetching from Ms Access via webservice.

The way I did(for similar scenario) is like here:

1. First collect all the pk values from data (comes via webservice) and Execute the "Delete query" to delete existing data with matching pks.

2. Insert all the data which comes via webservice as there will not be any duplicate data in that now.


这篇关于如何在数据库表中插入唯一记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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