如何通过使用存储过程在数据库表中插入数据,我应该保持身份 [英] how to insert data by using storedprocedure in my database table i should maintain identity

查看:74
本文介绍了如何通过使用存储过程在数据库表中插入数据,我应该保持身份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用storedprocedure ....插入数据.在我的数据库表中,我应该保持身份

我已创建存储过程,但未从前端数据插入

我在对表使用标识时遇到了这个问题...
请告诉我有关此问题的解决方案...

解决方案

使用源代码获取一个好的示例:
通过存储过程插入和检索数据 [ ^ ]

,默认情况下,您不能在Identity列中插入值.身份列是自计数的,并将生成其自己的值.
在身份字段中设置自己的值并不明智,但是可以将Set Identity_Insert [table_name]设置为ON.
请参见此处 [ 解决方案

Get a good example with source code:
Insert and retrieve data through stored procedure[^]


you cannot insert a value into the identity column by default. De identity column is self counting and will generate it''s own value.
It is not wise to set your own value in an identity field but with Set Identity_Insert [table_name] ON it can be done.
see here[^]


这篇关于如何通过使用存储过程在数据库表中插入数据,我应该保持身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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