smith
smith

Reputation: 3282

sql server and perl

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?

Upvotes: 0

Views: 219

Answers (1)

DVK
DVK

Reputation: 129559

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.

Upvotes: 3

Related Questions