且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何防止Sql Server表中多次进入前置数据修改?

更新时间:2023-02-22 15:14:53

使用strop程序插入你的数据,例子

http://www.sqlinfo.net/sqlserver/sql_server_stored_procedure_INSERT.php [ ^ ]

http://www.mssqltips.com/sqlservertutorial/2519/insert-stored-procedure-in-sql-server/ [ ^ ]



在附带程序中确保检查,



如果数据计数> = 3为此关键抛出异常

否则让它插入



和trans行动不经意。
use strop procedure to insert your data, examples
http://www.sqlinfo.net/sqlserver/sql_server_stored_procedure_INSERT.php[^]
http://www.mssqltips.com/sqlservertutorial/2519/insert-stored-procedure-in-sql-server/[^]

In side procedure make sure you check,

If data count >= 3 for this key throw exception
else let it to be inserted

and the transaction obliviously.