Sql Express - Multi user write in the same table

Vagelis Roidoulis 6 Reputation points
2020-12-21T09:25:37.81+00:00

Hi.
I m new in sql so i need your help.

i would like to know if it is possible multi user write in the same table.
I want to create a simple program in visual studio with a couple of forms.
At the end and if all the fields are ok i want to write the data in 1 table in an sql express db

Is this possible??
What should I watch out for??

Thanks and regards

PS: Sorry for my English
Do not hesitate to ask me anything you want

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,685 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 47,806 Reputation points
    2020-12-21T16:00:23.287+00:00

    Yes it is possible. That is what DBs are designed for. When multiple users try to write to the same table the DB will take a lock to ensure that the concurrent writes don't collide.

    You don't need to do anything special as DBs are set up to support this case. The most you want to be careful with is ensuring you don't lock the tables for long such as by using transactions when you don't need them. Since you're new to SQL I doubt you've gotten that far yet.

    But be aware that SQL Express (SE) is a lightweight DB designed for small workloads so the more you try to do with it the more likely you'll run into issues. If you're building a commercial app that needs to support any # of concurrent users then consider upgrading to SQL Server. The nice thing about SE is that it is the same as SQL so you can do your development on SE and then point it to the same database on SQL Server for production use. The only thing that changes is the config file.

    For SE there are limits to how big the DB can get, how many people can connect, etc. Also SE does not respond to network requests by default, IIRC. You also cannot have multiple instances of SE trying to connect to the same MDB file as that will cause problems. SE does run as a service so you'll have to configure the database as an actual database in SE and not just point it to an MDB file if you need to access it from different applications at the same time. Refer to the documentation on SE on how to do all this.

    0 comments No comments

  2. Cris Zhan-MSFT 6,601 Reputation points
    2020-12-23T04:46:29.753+00:00

    Hi,

    >i would like to know if it is possible multi user write in the same table.

    If the "write" mean insert operation. Yes, that's for sure.

    When you talk about multiple users operating a table at the same time (concurrent operations), I think you have involved SQL Server database transactions and lock knowledge. It is recommended that you check the related documents:
    https://learn.microsoft.com/en-us/sql/relational-databases/sql-server-transaction-locking-and-row-versioning-guide?view=sql-server-ver15

    0 comments No comments