SQL Server 和 Perl
我在 sql server 上有一张表,其中有一条记录和一个字段(一个整数值),我想每次加一并获取其结果,使用 perl DBI 模块和 sql server 实现此目的的最佳解决方案是什么?
I have a table on sql server which has one record and one field--an intger value--that I want to increment by one every time and get its result what is the best solution to implement this using the perl DBI module and sql server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有一个关于通过 DBI 连接到 SQL Server 的非常好的指南:http://members.toast。 net/strycher/perl/example_dbi_sql.htm
这是另一个:http://www.easysoft.com/developer/languages/perl/sql_server_unix_tutorial.html
但是,请注意,根据您的规模和目的:
您可能需要将增量 + 检索作为单个事务执行,以避免并发问题(如果您的目标是生成唯一的ID)
在某些卷上,以这种方式生成唯一 ID 会成为性能瓶颈,因为到拥有数据库热点。
如果您在尝试任何操作时遇到特定问题(建立 SQL Server 连接、编写适当的查询、执行查询并检索结果),请发布您的代码和问题,我们可以帮助您解决此问题。然而,StackOverflow 并不是“为我编写代码”的网站。
Here's a pretty good guide on connecting to SQL server via DBI: http://members.toast.net/strycher/perl/example_dbi_sql.htm
Here is another one: http://www.easysoft.com/developer/languages/perl/sql_server_unix_tutorial.html
However, please be aware that depending on your scale and purpose:
You may need to execute your increment+retrieval as a single transaction to avoid concurrency problems (if your goal is to generate unique IDs)
At certain volumes, generating unique IDs this way becomes a performance bottleneck due to having a DB hot spot.
If you're having specific problems with anything you tried (establishing an SQL server connection, writing an appropriate query, executing a query and retrieving the result) please post your code and the problem and we can assist you in resolving this. However, StackOverflow is not "write my code for me" site.