I tried the mention below query to stop duplicate before inserting data. It works fine with SQL database but its not working with access database. I want the same query to stop duplicate before inserting data to my access database. waiting for positive response. Thanks
我尝试在下面提到查询以在插入数据之前停止重复。它适用于SQL数据库,但它不能与访问数据库一起使用。我希望相同的查询在将数据插入到我的访问数据库之前停止重复。等待积极的回应。谢谢
IF NOT EXISTS (SELECT *
FROM dbo.Product
WHERE email = @email)
INSERT INTO dbo.Product(list of columns)
VALUES (list of values)
1 个解决方案
#1
0
In both cases (SQL Server and MS Access) you should create a proper UNIQUE INDEX on the email column of the Product table.
在这两种情况下(SQL Server和MS Access),您应该在Product表的email列上创建一个正确的UNIQUE INDEX。
For MS Access: http://office.microsoft.com/en-us/access-help/prevent-entry-of-duplicate-values-mdb-HP005187564.aspx
对于MS Access:http://office.microsoft.com/en-us/access-help/prevent-entry-of-duplicate-values-mdb-HP005187564.aspx
For SQL Server: http://technet.microsoft.com/en-us/library/ms189280.aspx
对于SQL Server:http://technet.microsoft.com/en-us/library/ms189280.aspx
#1
0
In both cases (SQL Server and MS Access) you should create a proper UNIQUE INDEX on the email column of the Product table.
在这两种情况下(SQL Server和MS Access),您应该在Product表的email列上创建一个正确的UNIQUE INDEX。
For MS Access: http://office.microsoft.com/en-us/access-help/prevent-entry-of-duplicate-values-mdb-HP005187564.aspx
对于MS Access:http://office.microsoft.com/en-us/access-help/prevent-entry-of-duplicate-values-mdb-HP005187564.aspx
For SQL Server: http://technet.microsoft.com/en-us/library/ms189280.aspx
对于SQL Server:http://technet.microsoft.com/en-us/library/ms189280.aspx