{"id":26421,"date":"2023-05-30T07:34:00","date_gmt":"2023-05-30T05:34:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=26421"},"modified":"2023-07-29T16:35:51","modified_gmt":"2023-07-29T14:35:51","slug":"t-sql-transactions","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/","title":{"rendered":"Introduction to T-SQL Transactions with practical examples"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\" id=\"h-t-sql-transactions-tutorial-with-practical-examples-using-the-begin-commit-and-rollback\"><strong><em>T-SQL transactions tutorial with practical examples using the BEGIN, COMMIT and ROLLBACK. <\/em><\/strong><\/h4>\n\n\n\n<p>T-SQL transactions are a sequence of one or more operations performed as a single logical unit of work. A logical unit of work must exhibit four properties, known as the atomicity, consistency, isolation, and durability (ACID) properties, to qualify as a transaction.T-SQL supports the use of transactions, which are important for preserving database integrity by ensuring that batches of SQL operations execute completely or not at all. They are used to make sure that work is committed (completed) or rolled back (undone) if errors occur in the batch.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-1-understanding-t-sql-transactions-and-the-acid-concept\">1. Understanding T-SQL Transactions and the ACID concept<\/h2>\n\n\n\n<p>A T-SQL transaction is a single unit of work that consists of one or more operations. It&#8217;s an essential concept in SQL Server, ensuring that all SQL commands within a single transaction are executed successfully as a group. If any command within the transaction fails, the entire transaction fails, and no database updates are applied.<\/p>\n\n\n\n<p>A transaction has a definite beginning and end. It starts when the first T-SQL command is executed and can end in one of two ways: either by being committed, which means all changes are saved to the database, or by being rolled back, which means all changes are discarded. Transactions follow the ACID properties, a critical set of principles for database transactions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Atomicity<\/strong>: <a href=\"https:\/\/link.springer.com\/article\/10.1007\/s00165-019-00489-w\" target=\"_blank\" rel=\"noreferrer noopener\">Atomicity ensures<\/a> that a transaction is treated as a single, indivisible unit of work. It either completes in its entirety or not at all. If an error occurs during the transaction, all changes are rolled back, and the database remains unchanged.<\/li>\n\n\n\n<li><strong>Consistency<\/strong>: Consistency guarantees that a transaction brings the database from one valid state to another. The database integrity constraints must be maintained for all transactions. For example, if a transaction attempts to violate a database constraint, it will be rolled back.<\/li>\n\n\n\n<li><strong>Isolation<\/strong>: Isolation ensures that each transaction is executed independently of others. This means that the execution of one transaction does not affect the execution of other transactions.<\/li>\n\n\n\n<li><strong>Durability<\/strong>: Durability ensures that once a transaction has been committed, its changes remain in the database even in the event of system failure.<\/li>\n<\/ul>\n\n\n\n<p>Understanding transactions and the ACID properties can help you design and implement better and more reliable database operations in T-SQL. They are critical for maintaining data integrity and ensuring the reliable execution of operations in a database.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-transaction-control-language-tcl-commands-in-t-sql\">2. Transaction Control Language (TCL) Commands in T-SQL<\/h2>\n\n\n\n<p>The 4 following keywords are the key Transaction Control Language commands:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>BEGIN TRANSACTION<\/code>: This marks the start of the transaction block. The syntax is <code>BEGIN TRAN [transaction_name]<\/code>.<\/li>\n\n\n\n<li><code>COMMIT<\/code>: This command saves the transaction permanently in the database. The syntax is <code>COMMIT TRAN [transaction_name]<\/code>.<\/li>\n\n\n\n<li><code>ROLLBACK<\/code>: This command undoes all the transaction statements and changes. The syntax is <code>ROLLBACK TRAN [transaction_name]<\/code>.<\/li>\n\n\n\n<li><code>SAVE TRANSACTION<\/code>: This sets a savepoint within a transaction, which can be used to roll back part of a transaction. The syntax is <code>SAVE TRAN [savepoint_name]<\/code>.<\/li>\n<\/ol>\n\n\n\n<p>In addition to transaction, to improve an d organize code and performance, you can <a href=\"https:\/\/expert-only.com\/en\/t-sql\/create-sql-server-index\/\">use SQL Server indexes<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"LndCPSsPt4\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/create-sql-server-index\/\">Create a SQL Server index<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Create a SQL Server index&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/create-sql-server-index\/embed\/#?secret=ga5jk9DBeH#?secret=LndCPSsPt4\" data-secret=\"LndCPSsPt4\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-practical-example-using-a-t-sql-transaction\">3. Practical Example Using a T-SQL Transaction<\/h2>\n\n\n\n<p>Here&#8217;s an example of a transaction using your <code>Sales<\/code> table. We&#8217;re inserting a new record, but we want to make sure that both Price and Sales are updated together or not at all to maintain data integrity.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">BEGIN TRAN; -- Start the transaction\n\n-- Try to insert a new record\nINSERT INTO Sales (CustomerID, MonthID, YearID, Qty, Price, Sales, ProductID, ProductName) \nVALUES (9, N'1', N'2023', 10.00, 1000.00, 10000.00, 20, N'ProductX');\n\n-- Update the Price and Sales for the new record\nUPDATE Sales \nSET Price = 1200.00, Sales = 12000.00 \nWHERE CustomerID = 9 AND ProductID = 20 AND YearID = '2023';\n\nCOMMIT; -- If no error so far, commit the transaction\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-4-handling-errors-using-the-rollback-operation-in-t-sql\">4. Handling Errors using The Rollback Operation in T-SQL<\/h2>\n\n\n\n<p>If an error occurs during the <code>INSERT<\/code> or <code>UPDATE<\/code> operations, you can issue a <code>ROLLBACK<\/code> command to undo all operations within this transaction:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ROLLBACK; -- Rollback the transaction because of an error\n<\/pre>\n\n\n\n<p>The <code>ROLLBACK<\/code> command undoes all the changes made in the current transaction back to the point of the last <code>BEGIN TRAN<\/code> statement.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-5-advanced-usage-with-t-sql-savepoints\">5. Advanced Usage with T-SQL Savepoints<\/h2>\n\n\n\n<p>You can also use a <code>SAVE TRANSACTION<\/code> command to set a savepoint within a transaction. This allows you to roll back part of a transaction:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">BEGIN TRAN;\n\n-- Try to insert a new record\nINSERT INTO Sales (CustomerID, MonthID, YearID, Qty, Price, Sales, ProductID, ProductName) \nVALUES (10, N'1', N'2023', 10.00, 1000.00, 10000.00, 21, N'ProductY');\n\n-- Save a transaction savepoint\nSAVE TRAN SP1;\n\n-- Try to update the Price and Sales for the new record\nUPDATE Sales \nSET Price = 1200.00, Sales = 12000.00 \nWHERE CustomerID = 10 AND ProductID = 21 AND YearID = '2023';\n\n-- If an error occurs during the update operation, rollback to the savepoint\nROLLBACK TRAN SP1;\n\nCOMMIT;\n<\/pre>\n\n\n\n<p>In this example, if an error occurs during the <code>UPDATE<\/code> operation, the <code>ROLLBACK TRAN SP1<\/code> command undoes all the changes made since the <code>SAVE TRAN SP1<\/code> statement, but it won&#8217;t affect the insert operation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-conclusion-on-sql-server-transactions-and-their-concepts\">Conclusion on SQL Server transactions and their concepts<\/h3>\n\n\n\n<p>Understanding transactions and proper usage of <code>BEGIN<\/code>, <code>COMMIT<\/code>, <code>ROLLBACK<\/code>, and <code>SAVE<\/code> commands are crucial for maintaining the ACID properties in your SQL Server database operations. To wrap up, in this comprehensive tutorial, we explored various aspects of T-SQL subqueries and transactions. Subqueries and transactions form an essential part of T-SQL as they help manage data efficiently and effectively, maintaining the integrity and reliability of operations. Subqueries enable us to write compact and more readable queries, while transactions ensure the database&#8217;s consistency, following the ACID principles.<\/p>\n\n\n\n<p>In the real world, databases and operations are often far more complex than the examples provided. However, with the concepts and skills learned in this tutorial, you are well-equipped to handle those challenges. Always remember the ACID principles when working with transactions and try to leverage subqueries when possible to make your queries more efficient and readable.<\/p>\n\n\n\n<p>To go further, let&#8217;s dive into a more classical and widely used topic, the <a href=\"https:\/\/expert-only.com\/en\/t-sql\/sql-server-subqueries\/\"><strong>T-SQL subqueries<\/strong><\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"vx4IU6iPa2\"><a href=\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/\">SQL Server subqueries tutorial with examples<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;SQL Server subqueries tutorial with examples&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/uncategorized\/sql-server-subqueries\/embed\/#?secret=fBOYLfRosI#?secret=vx4IU6iPa2\" data-secret=\"vx4IU6iPa2\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>T-SQL transactions tutorial with practical examples using the BEGIN, COMMIT and ROLLBACK. T-SQL transactions are a sequence of one or more operations performed as a single logical unit of work. A logical unit of work must exhibit four properties, <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/\" title=\"Introduction to T-SQL Transactions with practical examples\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":10834,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-26421","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>T-SQL Transactions with practical examples - SQL Server<\/title>\n<meta name=\"description\" content=\"Manage critical data operations with T-SQL transactions using practical examples and the BEGIN, COMMIT and ROLLBACK commands.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to T-SQL Transactions with practical examples\" \/>\n<meta property=\"og:description\" content=\"Manage critical data operations with T-SQL transactions using practical examples and the BEGIN, COMMIT and ROLLBACK commands.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-30T05:34:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-29T14:35:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/problem-1951987_1920x1080.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"Introduction to T-SQL Transactions with practical examples\",\"datePublished\":\"2023-05-30T05:34:00+00:00\",\"dateModified\":\"2023-07-29T14:35:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/\"},\"wordCount\":817,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/problem-1951987_1920x1080.jpg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/\",\"name\":\"T-SQL Transactions with practical examples - SQL Server\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/problem-1951987_1920x1080.jpg\",\"datePublished\":\"2023-05-30T05:34:00+00:00\",\"dateModified\":\"2023-07-29T14:35:51+00:00\",\"description\":\"Manage critical data operations with T-SQL transactions using practical examples and the BEGIN, COMMIT and ROLLBACK commands.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/problem-1951987_1920x1080.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/problem-1951987_1920x1080.jpg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introduction to T-SQL Transactions with practical examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"T-SQL Transactions with practical examples - SQL Server","description":"Manage critical data operations with T-SQL transactions using practical examples and the BEGIN, COMMIT and ROLLBACK commands.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/","og_locale":"en_US","og_type":"article","og_title":"Introduction to T-SQL Transactions with practical examples","og_description":"Manage critical data operations with T-SQL transactions using practical examples and the BEGIN, COMMIT and ROLLBACK commands.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2023-05-30T05:34:00+00:00","article_modified_time":"2023-07-29T14:35:51+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/problem-1951987_1920x1080.jpg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"Introduction to T-SQL Transactions with practical examples","datePublished":"2023-05-30T05:34:00+00:00","dateModified":"2023-07-29T14:35:51+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/"},"wordCount":817,"commentCount":0,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/problem-1951987_1920x1080.jpg","articleSection":["T-SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/","url":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/","name":"T-SQL Transactions with practical examples - SQL Server","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/problem-1951987_1920x1080.jpg","datePublished":"2023-05-30T05:34:00+00:00","dateModified":"2023-07-29T14:35:51+00:00","description":"Manage critical data operations with T-SQL transactions using practical examples and the BEGIN, COMMIT and ROLLBACK commands.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/problem-1951987_1920x1080.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2022\/09\/problem-1951987_1920x1080.jpg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/t-sql-transactions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"Introduction to T-SQL Transactions with practical examples"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/26421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=26421"}],"version-history":[{"count":0,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/26421\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/10834"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=26421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=26421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=26421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}