June 16, 2024, 12:46 p.m. | Karen Payne

DEV Community dev.to




Introduction


Learn how to add a new record to a SQL-Server database table and in the same SQL statement insert the new primary key and current user name into a secondary table. This permits a way to track who added a new record. Although not shown, the same technique can be used for update and delete operations.


Sample project





Basics


To add a new record to a Person table, create an INSERT statement followed by a SELECT separated by a …

csharp current database dotnetcore introduction key learn record server sql sql-server sqlserver table update

AI Focused Biochemistry Postdoctoral Fellow

@ Lawrence Berkeley National Lab | Berkeley, CA

Senior Data Engineer

@ Displate | Warsaw

Solutions Engineer

@ Stability AI | United States

Lead BizOps Engineer

@ Mastercard | O'Fallon, Missouri (Main Campus)

Senior Solution Architect

@ Cognite | Kuala Lumpur

Senior Front-end Engineer

@ Cognite | Bengaluru