All Questions
Tagged with powershell sql-server
1,902 questions
0
votes
0
answers
23
views
Alternative PowerShell Solution To Running MDX on a Power Bi Semantic Model Hosted In A Fabric Workspace
So we want to do this, but it's not supported. So we must pursue a alternative solution. Optimally this would something that could be run from SQL Server directly with minimal external code possible.
...
0
votes
0
answers
73
views
How to enable TCP protocol of SQL Server Express 2019 through C# code?
I have SQL Server Express 2019 installed in Windows 11 desktop. I want to enable SQL Server Express TCP protocol programmatically from Windows Application using C#.
So, I have written following simple ...
2
votes
1
answer
57
views
How can I exclude a Login's default database setting in DACPAC Publish
I am writing a Powershell script to create a SQL Server dacpac file from our QA database and publish it to the local db. I am using SQLPackage.exe. When I publish, I am getting an error:
Could not ...
1
vote
1
answer
68
views
Import multiple rows from CSV to SQL Server and create a new ID for each one
I'm trying to extract several "agent" rows from a .CSV file and send them to SQL Server, but the .CSV file Num Contrat.csv may be the same for several agents, whereas it must be unique in ...
0
votes
1
answer
59
views
How to extract ETL (Jobs) from SQL Server Management Studio
I want to extract the code from my Jobs (ETL) from my SQL Server 2014, which are in SQL Server Agent -> Jobs. I currently have more than 400, is there a faster way than entering each one and saving ...
0
votes
0
answers
45
views
Powershell script does not execute on SQL Server job
I get a zip file that includes a database backup from our customer that needs to be restored on our server on a regular basis. The restore is done on an staging server, the data is than processed ...
-1
votes
1
answer
54
views
SQL login using Azure Token failed
Invoke-Sqlcmd -ServerInstance $ServerInstance -Database $ExeDatabase -AccessToken $AccessToken -query "CREATE USER [$Appowner] FROM EXTERNAL PROVIDER"
Invoke-Sqlcmd : Login failed for user '...
1
vote
1
answer
81
views
Deploying A Single SSIS Package Using IsDeploymentWizard.exe In PowerShell for CI/CD
I have a powershell script using IsDeploymentWizard.exe to deploy a single SSIS package to SSISDB catalog.
# SSIS Deploy Script
#
param (
[Parameter(ValueFromPipelineByPropertyName)]
[String] $...
0
votes
0
answers
55
views
"Cannot index into a null array" : Data.SqlClient error with Powershell
I am creating a PowerShell script that bulk inserts a file from a directory into a SQL Server table. The script is as follows:
$server = "MYSERVER"
$database = "ERDS_LANDING"
$...
0
votes
0
answers
65
views
Running cmd or PowerShell script with OpenTelemetry Collector Contrib - config yaml to bring SQL Server version
I am trying to execute/run cmd or powershell script (ps1 file) with the OpenTelemetry Collector Contrib - config yaml file.
Following powershell script brings the installed SQL Server version at ...
0
votes
0
answers
142
views
Unable to embed external SQL scripts into Azure bicep deployment scripts
We have a SQL script that gets published to Azure artifacts. Then a deployment script using bicep to deploy the sql script to the database.
It picks up the file but throws the following error.
New-...
-2
votes
1
answer
110
views
How can I use Terraform to run a script to initialise the database on a newly-created Azure mssql_virtual_machine?
I've created an Azure Windows virtual machine using the MicrosoftSQLServer/sql2022-ws2022 source image, and I've attached to it an E: drive containing pre-existing SQL Server databases. I have a ...
0
votes
3
answers
164
views
Passing an array as a parameter from PowerShell to an SQL script
I'm creating a quite complex SQL script to delete from a database a bunch of records. Because I have to do a lot of operations, I want to save the IDs of the records I have to delete in a temporary ...
-1
votes
1
answer
92
views
SQL Server using Powershell - Error: the 'Invoke-SqlCmd' command was found in the module 'SQLPS', but the module could not be loaded
I'm encountering an error when trying to create a database and also to execute other queries in SQL Server using PowerShell's Invoke-SqlCmd command.
Environment:
Windows Version: 10.0.19045
...
0
votes
1
answer
50
views
PowerShell reading SQL - read multiple rows
I have successfully read a single returned value but can't quite get multiples.
My query is something like
select value
from table
where a in ('here', 'there').
In SQL Server, I see two rows ...