{"id":23889550,"url":"https://github.com/veepee-oss/vp.fsharp.sql.sqlserver","last_synced_at":"2025-04-10T06:05:37.241Z","repository":{"id":65504707,"uuid":"315918252","full_name":"veepee-oss/Vp.FSharp.Sql.SqlServer","owner":"veepee-oss","description":"F# Wrapper for SQL Server using Microsoft.Data.SqlClient and Vp.FSharp.Sql","archived":false,"fork":false,"pushed_at":"2022-08-20T23:32:16.000Z","size":62,"stargazers_count":10,"open_issues_count":3,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-04T00:23:43.078Z","etag":null,"topics":["adonet","fsharp","sql","sqlserver"],"latest_commit_sha":null,"homepage":"https://github.com/veepee-oss/Vp.FSharp.Sql.SqlServer","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/veepee-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-25T11:27:45.000Z","updated_at":"2021-10-24T18:33:05.000Z","dependencies_parsed_at":"2023-01-26T12:15:17.799Z","dependency_job_id":null,"html_url":"https://github.com/veepee-oss/Vp.FSharp.Sql.SqlServer","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veepee-oss%2FVp.FSharp.Sql.SqlServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veepee-oss%2FVp.FSharp.Sql.SqlServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veepee-oss%2FVp.FSharp.Sql.SqlServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veepee-oss%2FVp.FSharp.Sql.SqlServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veepee-oss","download_url":"https://codeload.github.com/veepee-oss/Vp.FSharp.Sql.SqlServer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232450929,"owners_count":18525286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adonet","fsharp","sql","sqlserver"],"created_at":"2025-01-04T10:09:48.277Z","updated_at":"2025-01-04T10:09:49.105Z","avatar_url":"https://github.com/veepee-oss.png","language":"F#","readme":"# Vp.FSharp.Sql.SqlServer\r\n\r\n\r\nAn opinionated F# library to interact with SQL Server databases following [`Vp.FSharp.Sql`](https://github.com/veepee-oss/Vp.FSharp.Sql) principles and relying on [`Microsoft.Data.SqlClient`](https://www.nuget.org/packages/Microsoft.Data.SqlClient).\r\n\r\n## Slagging Hype\r\n\r\nWe aim at following highly controversial practices to the best of our ability!\r\n\r\nStatus | Package                \r\n------ | ----------------------\r\nOK     | [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org)\r\nOK     | [![semver](https://img.shields.io/badge/semver-2.0.0-green)](https://semver.org/spec/v2.0.0.html)\r\nTBD    | [![keep a changelog](https://img.shields.io/badge/keep%20a%20changelog-1.0.0-red)](https://keepachangelog.com/en/1.0.0)\r\nTBD    | [![Semantic Release](https://img.shields.io/badge/Semantic%20Release-17.1.1-red)](https://semantic-release.gitbook.io/semantic-release)\r\n\r\n[Conventional Commits]: https://conventionalcommits.org\r\n[semver]: https://img.shields.io/badge/semver-2.0.0-blue\r\n[Semantic Release]: https://semantic-release.gitbook.io/semantic-release\r\n[keep a changelog]: https://keepachangelog.com/en/1.0.0\r\n\r\n## NuGet Package\r\n\r\n Name                      | Version  | Command |\r\n-------------------------- | -------- | ------- |\r\n `Vp.FSharp.Sql.SqlServer` | [![NuGet Status](http://img.shields.io/nuget/v/Vp.FSharp.Sql.SqlServer.svg)](https://www.nuget.org/packages/Vp.FSharp.Sql.SqlServer) | `Install-Package Vp.FSharp.Sql.SqlServer`\r\n\r\n# 📚 How to Use\r\n\r\n📝 Note: It's worth noting that the examples below illustrating functions running asynchronously do leverage `Async.RunSynchronously`. This is purely for the sake of reducing the nestedness that would happen if we were using `async` computation expressions instead.\r\n\r\n## 💿 Supported Database Values\r\n\r\nJust a little FYI:\r\n\r\n```fsharp\r\n/// Native SQL Server DB types.\r\n/// See https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings\r\n/// and https://stackoverflow.com/a/968734/4636721\r\ntype SqlServerDbValue =\r\n    | Null\r\n    /// System.Boolean.\r\n    /// An unsigned numeric value that can be 0, 1, or null.\r\n    | Bit of bool\r\n\r\n    | TinyInt  of uint8\r\n    | SmallInt of int16\r\n    | Int      of int32\r\n    | BigInt   of int64\r\n\r\n    | Real  of single\r\n    | Float of double\r\n\r\n    | SmallMoney of decimal\r\n    | Money      of decimal\r\n    | Decimal    of decimal\r\n    | Numeric    of decimal\r\n    \r\n    | Binary     of uint8 array\r\n    | VarBinary  of uint8 array\r\n    | Image      of uint8 array\r\n    | RowVersion of uint8 array\r\n    | FileStream of uint8 array\r\n    | Timestamp  of uint8 array\r\n\r\n    | UniqueIdentifier of Guid\r\n\r\n    | Time           of TimeSpan\r\n    | Date           of DateTime\r\n    | SmallDateTime  of DateTime\r\n    | DateTime       of DateTime\r\n    | DateTime2      of DateTime\r\n    | DateTimeOffset of DateTimeOffset\r\n\r\n    | Char     of string\r\n    | NChar    of string\r\n    | VarChar  of string\r\n    | NVarChar of string\r\n    | Text     of string\r\n    | NText    of string\r\n    \r\n    | Xml of SqlXml\r\n\r\n    | SqlVariant of obj\r\n    \r\n    | Custom of (SqlDbType * obj)\r\n```\r\n\r\n## 🧱`SqlServerCommand`\r\n\r\nThe main module is here to help you build and execute (Postgre)SQL commands (i.e. `SqlCommand` BTS).\r\n\r\n### 🏗️ Command Construction\r\n\r\nWe are obviously going to talk about how to build `SqlCommand` definitions.\r\n\r\n📝 Note: the meaning of the word \"update\" below has to be put in a F# perspective, i.e. **immutable** update, as in the update returns a new updated and immutable instance.\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003etext\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Initialize a new command definition with the given text contained in the given string.\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nSqlServerCommand.text \"SELECT 42;\"\r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n42\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003etextFromList\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Initialize a new command definition with the given text spanning over several strings (ie. list).\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n[ 0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55; ]\r\n|\u003e List.map (sprintf \"SELECT %d;\")\r\n|\u003e SqlServerCommand.textFromList\r\n|\u003e SqlServerCommand.queryList connection (fun _ _ read -\u003e read.Value\u003cint32\u003e 0)\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n[0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003enoLogger\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Update the command definition so that when executing the command, it doesn't use any logger.\r\n\u003e Be it the default one (Global, if any.) or a previously overriden one.\r\n\r\nExample:\r\n```fsharp\r\nSqlServerConfiguration.Logger (printfn \"Logging... %A\")\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nSqlServerCommand.text \"SELECT 42;\"\r\n|\u003e SqlServerCommand.noLogger\r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n42\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eoverrideLogger\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Update the command definition so that when executing the command, it use the given overriding logger.\r\n\u003e instead of the default one, aka the Global logger, if any.\r\n\r\nExample:\r\n```fsharp\r\nSqlServerConfiguration.NoLogger ()\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nSqlServerCommand.text \"SELECT 42;\"\r\n|\u003e SqlServerCommand.overrideLogger (printfn \"Logging... %A\")\r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```fsharp\r\nLogging... ConnectionOpened Npgsql.NpgsqlConnection\r\nLogging... CommandPrepared Npgsql.SqlCommand\r\nLogging... CommandExecuted (Npgsql.SqlCommand, 00:00:00.0162810)\r\nLogging... ConnectionClosed (Npgsql.NpgsqlConnection, 00:00:00.1007513)\r\n42\r\n```\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eparameters\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Update the command definition with the given parameters.\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nSqlServerCommand.text \"SELECT @a + @b;\"\r\n|\u003e SqlServerCommand.parameters [ (\"a\", Int 42); (\"b\", Real 42.42f) ]\r\n|\u003e SqlServerCommand.executeScalar\u003cdouble\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n84.0\r\n```\r\n\r\nNote: in case you want to pass some types that aren't yet supported by the library,  \r\nyou can use the `Custom` DU case which allows you to pass whatever underlying `SqlDbType` with the relevant `obj` value.\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003ecancellationToken\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Update the command definition with the given cancellation token.\r\n\r\nThis comes in handy when you need to interop with more traditional, C#-async, cancellation style.\r\n\r\nExample:\r\n```fsharp\r\ntry\r\n    use connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n    SqlServerCommand.text \"SELECT 42;\"\r\n    |\u003e SqlServerCommand.cancellationToken (CancellationToken(true))\r\n    |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n    |\u003e Async.RunSynchronously\r\n    |\u003e ignore\r\nwith\r\n | :? OperationCanceledException as e -\u003e\r\n     printfn \"The Command execution has been cancelled, reason: %A\" e.Message\r\n```\r\n\r\nOutput:\r\n```txt\r\nThe Command execution has been cancelled, reason: \"A task was canceled.\"\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003etimeout\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Update the command definition with the given timeout.\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eprepare\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Update the command definition and sets whether the command should be prepared or not.\r\n\r\nAs per [MS Docs](https://docs.microsoft.com/en-us/sql/ado/referento%20have%20the%20provider%20save%20a%20prepared%20(or%20compiled)%20version%20of%20the%20query%20specified%20in%20the%20CommandText%20property%20before%20a%20Command%20object's%20first%20execution.%20This%20may%20slow%20a%20command's%20first%20execution,%20but%20once%20the%20provider%20compiles%20a%20command,%20the%20provider%20will%20use%20the%20compiled%20version%20of%20the%20command%20for%20any%20subsequent%20executions,%20which%20will%20result%20in%20improved%20performance.e/ado-api/prepared-property-ado):\r\n\r\n\u003e Use the `Prepared` property to have the provider save a prepared (or compiled) version\r\n\u003e of the query specified in the CommandText property before a Command object's first\r\n\u003e execution.\r\n\u003e\r\n\u003e This may slow a command's first execution, but once the provider compiles\r\n\u003e a command, the provider will use the compiled version of the command for any subsequent\r\n\u003e executions, which will result in improved performance.\r\n\r\nExample: TBD\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003etransaction\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Update the command definition and set whether the command should be wrapped in the given transaction.\r\n\r\nExample:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nuse transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted)\r\n\r\n// Create a table\r\nSqlServerCommand.text $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n|\u003e SqlServerCommand.transaction transaction\r\n|\u003e SqlServerCommand.executeNonQuery connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n// The table is created here\r\nSqlServerCommand.text $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.transaction transaction\r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\ntransaction.Rollback()\r\n\r\n// The table creation has been rollbacked\r\nSqlServerCommand.text $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n-1\r\n1\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n### ⚙ Command Execution\r\n\r\nWe are obviously going to talk about how to execute `SqlCommand` definitions.\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003equeryAsyncSeq\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command and return the sets of rows as an `AsyncSeq` accordingly to the command definition.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample 1:\r\n```fsharp\r\ntype Row\u003c'T\u003e = { Set: int32; Record: int32; Data: 'T list }\r\n\r\nlet getCounterQuery n =\r\n    sprintf\r\n        \"\"\"\r\n        WITH RECURSIVE counter(value) AS (VALUES(1) UNION ALL SELECT value + 1 FROM counter WHERE value \u003c %d)\r\n        SELECT value FROM counter;\r\n        \"\"\" n\r\n\r\nlet readRow set record (read: SqlRecordReader\u003c_\u003e) =\r\n    { Set = set; Record = record; Data = List.init (read.Count) (read.Value\u003cint32\u003e) }\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n[ 0; 1; 1; 2; 3; 5 ]\r\n|\u003e List.map getCounterQuery\r\n|\u003e SqlServerCommand.textFromList\r\n|\u003e SqlServerCommand.queryAsyncSeq connection readRow\r\n|\u003e AsyncSeq.toListSynchronously\r\n|\u003e List.iter (fun x -\u003e printfn \"Set = %A; Row = %A; Data = %A\" x.Set x.Record x.Data)\r\n```\r\n\r\nOutput 1:\r\n```txt\r\nSet = 0; Row = 0; Data = [1]\r\nSet = 1; Row = 0; Data = [1]\r\nSet = 2; Row = 0; Data = [1]\r\nSet = 3; Row = 0; Data = [1]\r\nSet = 3; Row = 1; Data = [2]\r\nSet = 4; Row = 0; Data = [1]\r\nSet = 4; Row = 1; Data = [2]\r\nSet = 4; Row = 2; Data = [3]\r\nSet = 5; Row = 0; Data = [1]\r\nSet = 5; Row = 1; Data = [2]\r\nSet = 5; Row = 2; Data = [3]\r\nSet = 5; Row = 3; Data = [4]\r\nSet = 5; Row = 4; Data = [5]\r\n```\r\n\r\nNotes 📝:\r\n- The output type must be consistent across all the result sets and records.\r\n- If you need different types you may want to either:\r\n    - Create DU with each type you want to output\r\n    - Use `querySetList2` or `querySetList3` ⬇️\r\n- The `read`er can also get the `Value` given a certain field name:\r\n\r\nExample 2:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n[ 0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55; ]\r\n|\u003e List.map (sprintf \"SELECT %d AS cola;\")\r\n|\u003e SqlServerCommand.textFromList\r\n|\u003e SqlServerCommand.queryList connection (fun _ _ read -\u003e read.Value\u003cint32\u003e \"cola\")\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 2:\r\n```txt\r\n[0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003equerySeqSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command and return the sets of rows as a `seq` accordingly to the command definition.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample 1:\r\n```fsharp\r\ntype Row\u003c'T\u003e = { Set: int32; Record: int32; Data: 'T list }\r\n\r\nlet getCounterQuery n =\r\n    sprintf\r\n        \"\"\"\r\n        WITH RECURSIVE counter(value) AS (VALUES(1) UNION ALL SELECT value + 1 FROM counter WHERE value \u003c %d)\r\n        SELECT value FROM counter;\r\n        \"\"\" n\r\n\r\nlet readRow set record (read: SqlRecordReader\u003c_\u003e) =\r\n    { Set = set; Record = record; Data = List.init (read.Count) (read.Value\u003cint32\u003e) }\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n[ 0; 1; 1; 2; 3; 5 ]\r\n|\u003e List.map getCounterQuery\r\n|\u003e SqlServerCommand.textFromList\r\n|\u003e SqlServerCommand.querySeqSync connection readRow\r\n|\u003e Seq.iter (fun x -\u003e printfn \"Set = %A; Row = %A; Data = %A\" x.Set x.Record x.Data)\r\n```\r\n\r\nOutput 1:\r\n```txt\r\nSet = 0; Row = 0; Data = [1]\r\nSet = 1; Row = 0; Data = [1]\r\nSet = 2; Row = 0; Data = [1]\r\nSet = 3; Row = 0; Data = [1]\r\nSet = 3; Row = 1; Data = [2]\r\nSet = 4; Row = 0; Data = [1]\r\nSet = 4; Row = 1; Data = [2]\r\nSet = 4; Row = 2; Data = [3]\r\nSet = 5; Row = 0; Data = [1]\r\nSet = 5; Row = 1; Data = [2]\r\nSet = 5; Row = 2; Data = [3]\r\nSet = 5; Row = 3; Data = [4]\r\nSet = 5; Row = 4; Data = [5]\r\n```\r\n\r\nNotes 📝:\r\n- The output type must be consistent across all the result sets and records.\r\n- If you need different types you may want to either:\r\n    - Create DU with each type you want to output\r\n    - Use `querySetList2` or `querySetList3` ⬇️\r\n- The `read`er can also get the `Value` given a certain field name:\r\n\r\nExample 2:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n[ 0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55; ]\r\n|\u003e List.map (sprintf \"SELECT %d AS cola;\")\r\n|\u003e SqlServerCommand.textFromList\r\n|\u003e SqlServerCommand.queryList connection (fun _ _ read -\u003e read.Value\u003cint32\u003e \"cola\")\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 2:\r\n```txt\r\n[0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003equeryList\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command and return the sets of rows as a list accordingly to the command definition.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n[ 0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55; ]\r\n|\u003e List.map (sprintf \"SELECT %d;\")\r\n|\u003e SqlServerCommand.textFromList\r\n|\u003e SqlServerCommand.queryList connection (fun _ _ read -\u003e read.Value\u003cint32\u003e 0)\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n[0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003equeryListSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command and return the sets of rows as a list accordingly to the command definition.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n[ 0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55; ]\r\n|\u003e List.map (sprintf \"SELECT %d;\")\r\n|\u003e SqlServerCommand.textFromList\r\n|\u003e SqlServerCommand.queryListSync connection (fun _ _ read -\u003e read.Value\u003cint32\u003e 0)\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n[0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003equerySetList\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command and return the first set of rows as a list accordingly to the command definition.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample:\r\n```fsharp\r\ntype Row\u003c'T\u003e = { Set: int32; Record: int32; Data: 'T list }\r\n\r\nlet readRow set record (read: SqlRecordReader\u003c_\u003e)  =\r\n    { Set = set; Record = record; Data = List.init (read.Count) (read.Value\u003cint32\u003e) }\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n[ 0; 1; 1; 2; 3; 5 ]\r\n|\u003e List.map (sprintf \"SELECT %d;\")\r\n|\u003e SqlServerCommand.textFromList\r\n|\u003e SqlServerCommand.querySetList connection (readRow 1)\r\n|\u003e Async.RunSynchronously\r\n|\u003e List.iter (fun x -\u003e printfn \"Set = %A; Row = %A; Data = %A\" x.Set x.Record x.Data)\r\n```\r\n\r\nOutput:\r\n```txt\r\nSet = 1; Row = 0; Data = [0]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003equerySetListSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command and return the first set of rows as a list accordingly to the command definition.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\ntype Row\u003c'T\u003e = { Set: int32; Record: int32; Data: 'T list }\r\n\r\nlet readRow set record (read: SqlRecordReader\u003c_\u003e)  =\r\n    { Set = set; Record = record; Data = List.init (read.Count) (read.Value\u003cint32\u003e) }\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n[ 0; 1; 1; 2; 3; 5 ]\r\n|\u003e List.map (sprintf \"SELECT %d;\")\r\n|\u003e SqlServerCommand.textFromList\r\n|\u003e SqlServerCommand.querySetListSync connection (readRow 1)\r\n|\u003e List.iter (fun x -\u003e printfn \"Set = %A; Row = %A; Data = %A\" x.Set x.Record x.Data)\r\n```\r\n\r\nOutput:\r\n```txt\r\nSet = 1; Row = 0; Data = [0]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003equerySetList2\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command and return the 2 first sets of rows as a tuple of 2 lists accordingly to the command definition.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample:\r\n```fsharp\r\ntype Row\u003c'T\u003e = { Set: int32; Record: int32; Data: 'T list }\r\n\r\nlet readRow set record (read: SqlRecordReader\u003c_\u003e)  =\r\n    { Set = set; Record = record; Data = List.init (read.Count) (read.Value\u003cint32\u003e) }\r\n\r\nlet printRow row = printfn \"Set = %A; Row = %A; Data = %A\" row.Set row.Record row.Data\r\n\r\nlet set1, set2 =\r\n    use connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n    [ 0; 1; 1; 2; 3; 5 ]\r\n    |\u003e List.map (sprintf \"SELECT %d;\")\r\n    |\u003e SqlServerCommand.textFromList\r\n    |\u003e SqlServerCommand.querySetList2 connection (readRow 1) (readRow 2)\r\n    |\u003e Async.RunSynchronously\r\n\r\nList.iter printRow set1\r\nList.iter printRow set2\r\n```\r\n\r\nOutput:\r\n```txt\r\nSet = 1; Row = 0; Data = [0]\r\nSet = 2; Row = 0; Data = [1]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003equerySetList2Sync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command and return the 2 first sets of rows as a tuple of 2 lists accordingly to the command definition.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\ntype Row\u003c'T\u003e = { Set: int32; Record: int32; Data: 'T list }\r\n\r\nlet readRow set record (read: SqlRecordReader\u003c_\u003e)  =\r\n    { Set = set; Record = record; Data = List.init (read.Count) (read.Value\u003cint32\u003e) }\r\n\r\nlet printRow row = printfn \"Set = %A; Row = %A; Data = %A\" row.Set row.Record row.Data\r\n\r\nlet set1, set2 =\r\n    use connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n    [ 0; 1; 1; 2; 3; 5 ]\r\n    |\u003e List.map (sprintf \"SELECT %d;\")\r\n    |\u003e SqlServerCommand.textFromList\r\n    |\u003e SqlServerCommand.querySetList2Sync connection (readRow 1) (readRow 2)\r\n\r\nList.iter printRow set1\r\nList.iter printRow set2\r\n```\r\n\r\nOutput:\r\n```txt\r\nSet = 1; Row = 0; Data = [0]\r\nSet = 2; Row = 0; Data = [1]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003equerySetList3\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command and return the 3 first sets of rows as a tuple of 3 lists accordingly to the command definition.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample:\r\n```fsharp\r\ntype Row\u003c'T\u003e = { Set: int32; Record: int32; Data: 'T list }\r\n\r\nlet readRow set record (read: SqlRecordReader\u003c_\u003e)  =\r\n    { Set = set; Record = record; Data = List.init (read.Count) (read.Value\u003cint32\u003e) }\r\n\r\nlet printRow row = printfn \"Set = %A; Row = %A; Data = %A\" row.Set row.Record row.Data\r\n\r\nlet set1, set2, set3 =\r\n    use connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n    [ 0; 1; 1; 2; 3; 5 ]\r\n    |\u003e List.map (sprintf \"SELECT %d;\")\r\n    |\u003e SqlServerCommand.textFromList\r\n    |\u003e SqlServerCommand.querySetList3 connection (readRow 1) (readRow 2) (readRow 3)\r\n    |\u003e Async.RunSynchronously\r\n\r\nList.iter printRow set1\r\nList.iter printRow set2\r\nList.iter printRow set3\r\n```\r\n\r\nOutput:\r\n```txt\r\nSet = 1; Row = 0; Data = [0]\r\nSet = 2; Row = 0; Data = [1]\r\nSet = 3; Row = 0; Data = [1]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003equerySetList3Sync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command and return the 3 first sets of rows as a tuple of 3 lists accordingly to the command definition.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\ntype Row\u003c'T\u003e = { Set: int32; Record: int32; Data: 'T list }\r\n\r\nlet readRow set record (read: SqlRecordReader\u003c_\u003e)  =\r\n    { Set = set; Record = record; Data = List.init (read.Count) (read.Value\u003cint32\u003e) }\r\n\r\nlet printRow row = printfn \"Set = %A; Row = %A; Data = %A\" row.Set row.Record row.Data\r\n\r\nlet set1, set2, set3 =\r\n    use connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n    [ 0; 1; 1; 2; 3; 5 ]\r\n    |\u003e List.map (sprintf \"SELECT %d;\")\r\n    |\u003e SqlServerCommand.textFromList\r\n    |\u003e SqlServerCommand.querySetList3Sync connection (readRow 1) (readRow 2) (readRow 3)\r\n\r\nList.iter printRow set1\r\nList.iter printRow set2\r\nList.iter printRow set3\r\n```\r\n\r\nOutput:\r\n```txt\r\nSet = 1; Row = 0; Data = [0]\r\nSet = 2; Row = 0; Data = [1]\r\nSet = 3; Row = 0; Data = [1]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eexecuteScalar\u003c'Scalar\u003e\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command accordingly to its definition and,\r\n\u003e - return the first cell value, if it is available and of the given type.\r\n\u003e - throw an exception, otherwise.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nSqlServerCommand.text \"SELECT 42;\"\r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n42\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eexecuteScalarSync\u003c'Scalar\u003e\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command accordingly to its definition and,\r\n\u003e - return the first cell value, if it is available and of the given type.\r\n\u003e - throw an exception, otherwise.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nSqlServerCommand.text \"SELECT 42;\"\r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n42\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eexecuteScalarOrNone\u003c'Scalar\u003e\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command accordingly to its definition and,\r\n\u003e - return `Some`, if the first cell is available and of the given type.\r\n\u003e - return `None`, if first cell is `DBNull`.\r\n\u003e - throw an exception, otherwise.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n\r\nSqlServerCommand.text \"SELECT 42;\"\r\n|\u003e SqlServerCommand.executeScalarOrNone\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\nSqlServerCommand.text \"SELECT NULL;\"\r\n|\u003e SqlServerCommand.executeScalarOrNone\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n0\r\n```\r\n\r\nOutput:\r\n```txt\r\nSome 42\r\nNone\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eexecuteScalarOrNoneSync\u003c'Scalar\u003e\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command accordingly to its definition and,\r\n\u003e - return `Some`, if the first cell is available and of the given type.\r\n\u003e - return `None`, if first cell is `DBNull`.\r\n\u003e - throw an exception, otherwise.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\n\r\nSqlServerCommand.text \"SELECT 42;\"\r\n|\u003e SqlServerCommand.executeScalarOrNoneSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n\r\nSqlServerCommand.text \"SELECT NULL;\"\r\n|\u003e SqlServerCommand.executeScalarOrNoneSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n0\r\n```\r\n\r\nOutput:\r\n```txt\r\nSome 42\r\nNone\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eexecuteNonQuery\u003c'Scalar\u003e\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command accordingly to its definition and, return the number of rows affected.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nSqlServerCommand.text \"SELECT 42;\"\r\n|\u003e SqlServerCommand.executeNonQuery connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n-1\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eexecuteNonQuerySync\u003c'Scalar\u003e\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Execute the command accordingly to its definition and, return the number of rows affected.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nSqlServerCommand.text \"SELECT 42;\"\r\n|\u003e SqlServerCommand.executeNonQuerySync connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n-1\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n## 🦮 `SqlServerNullDbValue`: Null Helpers\r\n\r\nThe module to handle options and results in parameters.\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eifNone\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Return SqlServer DB Null value if the given option is `None`, otherwise the underlying wrapped in `Some`.\r\n\r\nExample:\r\n```fsharp\r\n[ \"a\", SqlServerNullDbValue.ifNone Integer (Some 42)\r\n  \"b\", SqlServerNullDbValue.ifNone Integer (None) ]\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n[(\"a\", Integer 42); (\"b\", Null)]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003eifError\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Return SqlServer DB Null value if the given option is `Error`, otherwise the underlying wrapped in `Ok`.\r\n\r\nExample:\r\n```fsharp\r\n[ \"a\", SqlServerNullDbValue.ifError Integer (Ok 42)\r\n  \"b\", SqlServerNullDbValue.ifError Integer (Error \"meh\") ]\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n[(\"a\", Integer 42); (\"b\", Null)]\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n## 🚄 `SqlServerTransaction`: Transaction Helpers\r\n\r\nThis is the main module to interact with `SqlTransaction`.\r\n\r\n📝 Note: The default isolation level is [`ReadCommitted`](https://docs.microsoft.com/en-us/dotnet/api/system.data.isolationlevel).\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003ecommit\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection, isolation, cancellation token and transaction body.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.commit (CancellationToken.None) (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    return!\r\n        SqlServerCommand.text $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n1\r\n1\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003ecommitSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection, isolation and transaction body.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.commitSync (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e\r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeNonQuerySync connection\r\n    |\u003e ignore\r\n\r\n    SqlServerCommand.text $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n1\r\n1\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003enotCommit\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and do not commit an automatically generated transaction with the given connection, isolation, cancellation token and transaction body.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.notCommit (CancellationToken.None) (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\" \r\n        |\u003e SqlServerCommand.text\r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    return!\r\n        $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n        |\u003e SqlServerCommand.text\r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n1\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003enotCommitSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and do not commit an automatically generated transaction with the given connection, isolation and transaction body.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.notCommitSync (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e \r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\" \r\n    |\u003e SqlServerCommand.text\r\n    |\u003e SqlServerCommand.executeNonQuery connection\r\n    |\u003e ignore\r\n\r\n    $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n    |\u003e SqlServerCommand.text\r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n1\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003ecommitOnSome\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection, isolation, cancellation token and transaction body.\r\n\u003e\r\n\u003e The commit phase only occurs if the transaction body returns Some.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample 1:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.commitOnSome (CancellationToken.None) (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    do! $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n        |\u003e SqlServerCommand.text\r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n        |\u003e Async.Ignore\r\n    return Some 42\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 1:\r\n```txt\r\nSome 42\r\n1\r\n```\r\n\r\nExample 2:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.commitOnSome (CancellationToken.None) (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    do! $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\" \r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n        |\u003e Async.Ignore\r\n    return None\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 2:\r\n```txt\r\nNone\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003ecommitOnSomeSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection, isolation and transaction body.\r\n\u003e\r\n\u003e The commit phase only occurs if the transaction body returns Some.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample 1:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.commitOnSomeSync (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e \r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeNonQuerySync connection\r\n    |\u003e ignore\r\n\r\n    $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n    |\u003e SqlServerCommand.text\r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n    |\u003e ignore\r\n    return Some 42\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 1:\r\n```txt\r\nSome 42\r\n1\r\n```\r\n\r\nExample 2:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.commitOnSomeSync (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e\r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeNonQuerySync connection\r\n    |\u003e ignore\r\n\r\n    $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\" \r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n    |\u003e ignore\r\n    return None\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 2:\r\n```txt\r\nNone\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003ecommitOnOk\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection, isolation, cancellation token and transaction body.\r\n\u003e\r\n\u003e The commit phase only occurs if the transaction body returns Ok.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample 1:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.commitOnOk (CancellationToken.None) (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n        |\u003e SqlServerCommand.text\r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    do! $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n        |\u003e Async.Ignore\r\n    return Ok 42\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 1:\r\n```txt\r\nOk 42\r\n1\r\n```\r\n\r\nExample 2:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.commitOnOk (CancellationToken.None) (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    do! $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n        |\u003e SqlServerCommand.text\r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n        |\u003e Async.Ignore\r\n    return Error \"fail\"\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 2:\r\n```txt\r\nError \"fail\"\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003ecommitOnOkSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection, isolation and transaction body.\r\n\u003e\r\n\u003e The commit phase only occurs if the transaction body returns Ok.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample 1:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.commitOnOkSync (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e\r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n    |\u003e SqlServerCommand.text\r\n    |\u003e SqlServerCommand.executeNonQuerySync connection\r\n    |\u003e ignore\r\n\r\n    $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n    |\u003e ignore\r\n    return Ok 42\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 1:\r\n```txt\r\nOk 42\r\n1\r\n```\r\n\r\nExample 2:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.commitOnOkSync (IsolationLevel.ReadCommitted) connection (fun connection _ -\u003e\r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeNonQuerySync connection\r\n    |\u003e ignore\r\n\r\n    $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n    |\u003e SqlServerCommand.text\r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n    |\u003e ignore\r\n    return Error \"fail\"\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 2:\r\n```txt\r\nError \"fail\"\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003edefaultCommit\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection and transaction body.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultCommit connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    return!\r\n        SqlServerCommand.text $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n1\r\n1\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003edefaultCommitSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection and transaction body.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultCommitSync connection (fun connection _ -\u003e\r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeNonQuerySync connection\r\n    |\u003e ignore\r\n\r\n    SqlServerCommand.text $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n1\r\n1\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003edefaultNotCommit\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and do not commit an automatically generated transaction with the given connection and transaction body.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultNotCommit connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\" \r\n        |\u003e SqlServerCommand.text\r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    return!\r\n        $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n        |\u003e SqlServerCommand.text\r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n1\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003edefaultNotCommitSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and do not commit an automatically generated transaction with the given connection and transaction body.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultNotCommitSync connection (fun connection _ -\u003e \r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\" \r\n    |\u003e SqlServerCommand.text\r\n    |\u003e SqlServerCommand.executeNonQuery connection\r\n    |\u003e ignore\r\n\r\n    $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n    |\u003e SqlServerCommand.text\r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput:\r\n```txt\r\n1\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003edefaultCommitOnSome\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection and transaction body.\r\n\u003e\r\n\u003e The commit phase only occurs if the transaction body returns Some.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample 1:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultCommitOnSome connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    do! $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n        |\u003e SqlServerCommand.text\r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n        |\u003e Async.Ignore\r\n    return Some 42\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 1:\r\n```txt\r\nSome 42\r\n1\r\n```\r\n\r\nExample 2:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultCommitOnSome connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    do! $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\" \r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n        |\u003e Async.Ignore\r\n    return None\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 2:\r\n```txt\r\nNone\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003edefaultCommitOnSomeSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection and transaction body.\r\n\u003e\r\n\u003e The commit phase only occurs if the transaction body returns Some.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample 1:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultCommitOnSomeSync connection (fun connection _ -\u003e \r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeNonQuerySync connection\r\n    |\u003e ignore\r\n\r\n    $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n    |\u003e SqlServerCommand.text\r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n    |\u003e ignore\r\n    return Some 42\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 1:\r\n```txt\r\nSome 42\r\n1\r\n```\r\n\r\nExample 2:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultCommitOnSomeSync connection (fun connection _ -\u003e\r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeNonQuerySync connection\r\n    |\u003e ignore\r\n\r\n    $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\" \r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n    |\u003e ignore\r\n    return None\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 2:\r\n```txt\r\nNone\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003edefaultCommitOnOk\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection and transaction body.\r\n\u003e\r\n\u003e The commit phase only occurs if the transaction body returns Ok.\r\n\u003e\r\n\u003e This function runs asynchronously.\r\n\r\nExample 1:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultCommitOnOk connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n        |\u003e SqlServerCommand.text\r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    do! $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n        |\u003e Async.Ignore\r\n    return Ok 42\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 1:\r\n```txt\r\nOk 42\r\n1\r\n```\r\n\r\nExample 2:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultCommitOnOk connection (fun connection _ -\u003e async {\r\n    do! $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n        |\u003e SqlServerCommand.text \r\n        |\u003e SqlServerCommand.executeNonQuery connection\r\n        |\u003e Async.Ignore\r\n\r\n    do! $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n        |\u003e SqlServerCommand.text\r\n        |\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n        |\u003e Async.Ignore\r\n    return Error \"fail\"\r\n})\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalar\u003cint32\u003e connection\r\n|\u003e Async.RunSynchronously\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 2:\r\n```txt\r\nError \"fail\"\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e \r\n\u003csummary\u003e\u003ccode\u003edefaultCommitOnOkSync\u003c/code\u003e\u003c/summary\u003e\r\n\r\n\u003e Create and commit an automatically generated transaction with the given connection and transaction body.\r\n\u003e\r\n\u003e The commit phase only occurs if the transaction body returns Ok.\r\n\u003e\r\n\u003e This function runs synchronously.\r\n\r\nExample 1:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultCommitOnOkSync connection (fun connection _ -\u003e\r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n    |\u003e SqlServerCommand.text\r\n    |\u003e SqlServerCommand.executeNonQuerySync connection\r\n    |\u003e ignore\r\n\r\n    $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n    |\u003e ignore\r\n    return Ok 42\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 1:\r\n```txt\r\nOk 42\r\n1\r\n```\r\n\r\nExample 2:\r\n```fsharp\r\nlet tableName = \"people\"\r\n\r\nuse connection = new SqlConnection(\"Server=192.168.0.1,4242;Database=MyDatabase;User Id=myuser;Password=mypassword\")\r\nconnection.Open()\r\n\r\nSqlServerTransaction.defaultCommitOnOkSync connection (fun connection _ -\u003e\r\n    $\"CREATE TABLE {tableName} (id int IDENTITY(1,1) PRIMARY KEY, name TEXT NOT NULL);\"\r\n    |\u003e SqlServerCommand.text \r\n    |\u003e SqlServerCommand.executeNonQuerySync connection\r\n    |\u003e ignore\r\n\r\n    $\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n    |\u003e SqlServerCommand.text\r\n    |\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n    |\u003e ignore\r\n    return Error \"fail\"\r\n)\r\n|\u003e printfn \"%A\"\r\n\r\n$\"SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'{tableName}';\"\r\n|\u003e SqlServerCommand.text \r\n|\u003e SqlServerCommand.executeScalarSync\u003cint32\u003e connection\r\n|\u003e printfn \"%A\"\r\n```\r\n\r\nOutput 2:\r\n```txt\r\nError \"fail\"\r\n0\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n# ❤ How to Contribute\r\nBug reports, feature requests, and pull requests are very welcome! Please read the [Contribution Guidelines](./CONTRIBUTION.md) to get started.\r\n\r\n# 📜 Licensing\r\nThe project is licensed under MIT. For more information on the license see the [license file](./LICENSE).\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveepee-oss%2Fvp.fsharp.sql.sqlserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveepee-oss%2Fvp.fsharp.sql.sqlserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveepee-oss%2Fvp.fsharp.sql.sqlserver/lists"}