A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/developer-guide/python-connector/../../sql-reference/sql/begin below:

Website Navigation


BEGIN | Snowflake Documentation

BEGIN

Begins a transaction in the current session.

START TRANSACTION is a synonym for BEGIN.

See also:

COMMIT , ROLLBACK , SHOW TRANSACTIONS , DESCRIBE TRANSACTION

Syntax
BEGIN [ { WORK | TRANSACTION } ] [ NAME <name> ]

START TRANSACTION [ NAME <name> ]

Copy

Parameters
WORK | TRANSACTION

Optional keywords that provide compatibility with other database systems.

NAME name

Optional string that assigns a name to the transaction. A name helps identify a transaction, but is not required and does not need to be unique.

Usage notes Examples

Note

These examples do not include the necessary commands for completing the transactions. For examples of complete transactions, see COMMIT or ROLLBACK.

Begin a transaction:

BEGIN;

SHOW TRANSACTIONS;

+---------------+--------+--------------+--------------------------------------+-------------------------------+---------+
|            id | user   |      session | name                                 | started_on                    | state   |
|---------------+--------+--------------+--------------------------------------+-------------------------------+---------|
| 1530042321085 | USER1  | 223347060798 | 56cb9163-77a3-4223-b3e0-aa24a20540a3 | 2018-06-26 12:45:21.085 -0700 | running |
+---------------+--------+--------------+--------------------------------------+-------------------------------+---------+

SELECT CURRENT_TRANSACTION();

+-----------------------+
| CURRENT_TRANSACTION() |
|-----------------------|
| 1530042321085         |
+-----------------------+

Copy

Note the system-assigned name, 56cb9163-77a3-4223-b3e0-aa24a20540a3, for the transaction.

Begin a transaction with a specified name:

BEGIN NAME T1;

SHOW TRANSACTIONS;

+---------------+--------+--------------+------+-------------------------------+---------+
|            id | user   |      session | name | started_on                    | state   |
|---------------+--------+--------------+------+-------------------------------+---------|
| 1530042377426 | USER1  | 223347060798 | T1   | 2018-06-26 12:46:17.426 -0700 | running |
+---------------+--------+--------------+------+-------------------------------+---------+

SELECT CURRENT_TRANSACTION();

+-----------------------+
| CURRENT_TRANSACTION() |
|-----------------------|
| 1530042377426         |
+-----------------------+

Copy

This example is the same as the previous example, but uses START TRANSACTION instead of BEGIN:

START TRANSACTION NAME T2;

SHOW TRANSACTIONS;

+---------------+--------+--------------+------+-------------------------------+---------+
|            id | user   |      session | name | started_on                    | state   |
|---------------+--------+--------------+------+-------------------------------+---------|
| 1530042467963 | USER1  | 223347060798 | T2   | 2018-06-26 12:47:47.963 -0700 | running |
+---------------+--------+--------------+------+-------------------------------+---------+

SELECT CURRENT_TRANSACTION();

+-----------------------+
| CURRENT_TRANSACTION() |
|-----------------------|
| 1530042467963         |
+-----------------------+

Copy


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4