PoshCode Archive  Check-in [ef9d19928f]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Modeled after SQL Server 2008 Invoke-Sqlcmd, but fixes bug in QueryTimeout, and allows for paramaterized queries and more!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:ef9d19928fad47af65f60c6dc4b9fbd9719e5f173035c7f4d51e3052fa075070
User & Date: Aaron Calderon 2018-06-10 14:13:34
Context
2018-06-10
14:13
test post sqldom check-in: 18b6f4a204 user: ietei tags: trunk
14:13
Modeled after SQL Server 2008 Invoke-Sqlcmd, but fixes bug in QueryTimeout, and allows for paramaterized queries and more! check-in: ef9d19928f user: Aaron Calderon tags: trunk
14:13
Modeled after SQL Server 2008 Invoke-Sqlcmd, but fixes bug in QueryTimeout, and allows for paramaterized queries and more! check-in: e58f7ee5db user: RCookieMonster tags: trunk
Changes

Changes to Invoke-SqlCmd2.ps1.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# encoding: ascii
# api: powershell
# title: Invoke-SqlCmd2 ()
# description: Modeled after SQL Server 2008 Invoke-Sqlcmd, but fixes bug in QueryTimeout, and allows for paramaterized queries and more!
# version: 1.5.3
# type: script
# author: RCookieMonster
# license: CC0
# function: Invoke-Sqlcmd2
# x-poshcode-id: 6340
# x-derived-from-id: 6341
# x-archived: 2016-07-26T06:24:25
# x-published: 2016-05-11T13:54:00
#
#
####################### 
<# 
.SYNOPSIS 
    Runs a T-SQL script. 

................................................................................
        [string]$As="DataRow",
    
        [Parameter(Position=8, Mandatory=$false)]
        [System.Collections.IDictionary]$SqlParameters,

        [switch]$DBNullToNull,

        [Parameter(Mandatory=$false)] [switch]$TrustedConnection, 
    ) 
 
    if ($InputFile) 
    { 
        $filePath = $(Resolve-Path $InputFile).path 
        $Query =  [System.IO.File]::ReadAllText("$filePath") 
    } 






|


|
<
|
|







 







|







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
...
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# encoding: ascii
# api: powershell
# title: Invoke-SqlCmd2 ()
# description: Modeled after SQL Server 2008 Invoke-Sqlcmd, but fixes bug in QueryTimeout, and allows for paramaterized queries and more!
# version: 1.5.3
# type: script
# author: Aaron Calderon
# license: CC0
# function: Invoke-Sqlcmd2
# x-poshcode-id: 6341

# x-archived: 2016-05-17T12:33:54
# x-published: 2016-05-11T14:40:00
#
#
####################### 
<# 
.SYNOPSIS 
    Runs a T-SQL script. 

................................................................................
        [string]$As="DataRow",
    
        [Parameter(Position=8, Mandatory=$false)]
        [System.Collections.IDictionary]$SqlParameters,

        [switch]$DBNullToNull,

        [Parameter(Mandatory=$false)] [switch]$TrustedConnection 
    ) 
 
    if ($InputFile) 
    { 
        $filePath = $(Resolve-Path $InputFile).path 
        $Query =  [System.IO.File]::ReadAllText("$filePath") 
    }