Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
129 views

I have a fresh installation of SQL Server 2022 LocalDB. When I try to initialize a database with a script using the command: sqlcmd -S (localdb)\MSSQLLocalDB -E I get the following error: No named ...
Ait Yahia Idir's user avatar
0 votes
1 answer
99 views

I can get the data exported and my CSV created but I can't get headers to show up on the file. This is my batch file code sqlcmd -S SERVERNAME -U TEST -P TEST123 -d "TESTDB" -Q "set ...
bk171's user avatar
  • 11
1 vote
1 answer
37 views

I have an implementation script written in SQLCMD. We store these scripts in our Visual Studio solution file, under a DB project. This script throws a ton of errors because VS thinks it's bad SQL. ...
ARLibertarian's user avatar
1 vote
0 answers
48 views

When I run the command, I get Column name or number of supplied values does not match table definition. The output from sp_help_jobhistory returns 11 columns which I have defined in my table. Here is ...
Dave Johnson's user avatar
0 votes
0 answers
67 views

I am trying to run a Powershell script off of a VM using Azure to automate a report coming from a SQL DB. I am running it via a job in Logic Apps but when testing the current script I am getting a &...
Cole Mertz's user avatar
0 votes
0 answers
119 views

I am trying to run an INSERT query through SQLCMD, passing values from a variable. This command runs successfully on many servers except one, where it is failing. Below is my command, where TESTID is ...
SuperAdi's user avatar
0 votes
0 answers
22 views

This query has been running fine for the last year. It is executed from sqlcmd.exe in a bash script because we have a Linux dependency. The UPDATE statement failed due to a "Arithmetic overflow ...
aRBee's user avatar
  • 166
0 votes
1 answer
439 views

I have an Azure Container App Job running a shell script, one of the commands in said script is sqlcmd. Currently I can run the command successfully if I use user name/password authentication but I ...
hudsonsc's user avatar
  • 173
0 votes
1 answer
40 views

I have this script (my_script.sql): SET NOCOUNT ON; DECLARE @SchemaName NVARCHAR(128); DECLARE @TableName NVARCHAR(128); SET @SchemaName = '$(SchemaName)'; SET @TableName = '$(TableName)'; IF @...
dfashimpaur's user avatar
2 votes
0 answers
69 views

I’m trying to connect to a SQL Server using SQLCMD. While extracting data, one of my columns has a data length of 1500 characters. If I don’t specify the -y option, the data for this column is limited ...
Madhava Naidu's user avatar
-1 votes
1 answer
341 views

I have this T-SQL code: declare @DBNAAM varbinary(128) = cast((select DB_NAME() as [Current Database]) + '_SINGLES-' as varbinary(128)); set context_info @DBNAAM; go print cast(context_info() as ...
gilberke's user avatar
0 votes
3 answers
449 views

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 ...
Enrico's user avatar
  • 6,902
-1 votes
1 answer
433 views

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 ...
dede kyuti's user avatar
0 votes
0 answers
80 views

I’m unable to connect to my local SQL Server instance using sqlcmd. Despite trying several troubleshooting steps, I’m still facing connection issues. Here’s the error I receive: PS C:\Users\it ...
Syed Ahad Ali's user avatar
0 votes
0 answers
68 views

SQLCMD truncates my error long before I see the relevant part of the error. How can I make SQLCMD give me the full error message when the error message is very long? -y 0 does not fix the problem.
J. Mini's user avatar
  • 1,766
0 votes
1 answer
85 views

I have a legacy database that is running SQL Server 2008 R2 Express Edition. Today, I was trying to use sqlacodegen to generate SQLAlchemy classes via the pyodbc package. I was able to connect to the ...
Andrew's user avatar
  • 669
0 votes
1 answer
136 views

I need to get both the full text of an actual execution plan and my full table of results with column names from sqlcmd. My first requirement forces to me pass in -y 0 as documented here. However, ...
J. Mini's user avatar
  • 1,766
4 votes
1 answer
235 views

I have this little SQL script: CREATE PROCEDURE Something AS EXEC SomethingNotExist; Normally SQL Server Management Studio shows this message: The module 'Something' depends on the missing object '...
trob's user avatar
  • 155
0 votes
1 answer
911 views

I want to pass variables to the SqlAzureDacpacDeployment@1 (or DotNetCoreCLI@2) task of an SQL Server instance while running an Azure Pipeline. This variable is going to be the env (dev, acceptance, ...
Potis23's user avatar
  • 534
0 votes
1 answer
599 views

I am using NVIDIA Jetson Orin nano board (which is based on ARM64 architecture) to as an IoT Edge device to deploy Azure Edge modules from Azure marketplace. I have deployed the temperature sensor and ...
Hey Hello's user avatar
0 votes
0 answers
143 views

I have a sql script that my batch file is executing, and I'm generating a .csv file with the >> syntax. When I switch the .csv to .xlsx, then the file doesn't place the distinct data elements ...
MartaR's user avatar
  • 1
0 votes
0 answers
73 views

I am trying to run SQL command using SQL file in Python process = subprocess.Popen(shlex.split(command), stdout=log) print("command: {}".format(command)) print("split cmd: {}"....
wanchaiS's user avatar
0 votes
0 answers
37 views

I'm using sqlcmd in SQL Server to, create a action to move data from one structure to a other predefined database table. where both have the same collation Where I have some French column names. like: ...
Lasse Støjier Pedersen's user avatar
0 votes
1 answer
1k views

I'm currently facing an issue with connecting to an Azure SQL Database using PowerShell's Invoke-Sqlcmd cmdlet. I am able to successfully connect to the database using sqlcmd (Version 18.2.0001.1 ...
Shimii's user avatar
  • 25
0 votes
0 answers
104 views

SCRIPT TO EXTRACT THE ALL DETAILS #Variable to hold variable. $SQLServer = "XXXX" $SQLDBName = "XXXX" #Customer data input file path $InputFile = "F:\\...
sampath palli's user avatar
1 vote
2 answers
526 views

I have a list of database connections in a table and want to iterate through them, connecting to each one within SQL Server through a script, and then execute a select statement. Initially, I ...
ANR's user avatar
  • 41
0 votes
2 answers
352 views

We are using DevOps YAML pipelines to build and deploy database changes to our production environment. The database is deployed through a DACPAC file. We have a pre and post deployment file configured ...
Koen van Wielink's user avatar
1 vote
0 answers
94 views

I am working on SQL server task. I need a sqlcmd result file with complete records with headers. Here is the command and error message below sqlcmd -S [Server_Name] -U [User_Name] -P [Password] -d [...
Yuvaraj's user avatar
  • 21
2 votes
1 answer
151 views

I am doing MySql queries pipeline and using results to transfer data do storage account. For DB query and transfer data to .txt file, I use this command: sqlcmd -S $(Server_prod) -i "G:\...
Michał Picheta's user avatar
0 votes
0 answers
173 views

I have a sql cmd .bat file that executes a query and returns the query results to a .rpt file (tab delimited). Now in one of the column, not all characters are returned in the .rpt output file. What I ...
Hayco's user avatar
  • 37
0 votes
0 answers
89 views

I have several related SSDT SQL Database (.sqlproj) projects in a Visual Studio Solution. Each project has a set of SQLCMD variables and we use the Database Reference feature to enable cross-project/...
Adam's user avatar
  • 2,031
3 votes
2 answers
996 views

I wrote a shell script to automate the download and restore of a SQL Server database. The script works great with one exception. It downloads the .bak file(s) that it is supposed to and then, if ...
TRezendes's user avatar
  • 108
1 vote
0 answers
68 views

I'm exporting records from a SQL server to a csv file. sqlcmd -y0 -S server -d database -U username -P password -o C:\outfiles\data.csv -s ";" -Q "SET NOCOUNT ON; select field1, field2, ...
Bera's user avatar
  • 2,228
1 vote
1 answer
1k views

We have a requirement to connect to Azure SQL Database using Service Principal Details. We are using SSMS(v19) and sqlcmd to connect. What we done so far: Create service principal and secret Assign ...
Varghese's user avatar
2 votes
1 answer
519 views

I have been using the windows-native sqlcmd to run scripts on my local SQL Server database. I have a set of script files that will create the database, add tables and indices, populate domain data, ...
JohnXF's user avatar
  • 1,085
0 votes
0 answers
77 views

I am writing a script for reading remote SQL instances. I have a problem with the transfer of the ServerInstance Variable. I just can't find the error. Does anyone have an idea? This Command is ...
Daniel4711's user avatar
-1 votes
2 answers
93 views

I'm trying to use sqlcmd utility and the query is working I'm just wondering how I can get just the value without fieldname and those dashes? $res = sqlcmd -Q @" :Connect . use [...
Rod's user avatar
  • 15.6k
6 votes
0 answers
7k views

I'm creating instance of SQL Server in a Docker container. $ sudo docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Adminxyz22#" -p 1433:1433 --name sql3 -d mcr.microsoft.com/mssql/...
user51's user avatar
  • 10.6k
3 votes
1 answer
3k views

Is there any way to set SQLCMD mode in Azure Data Studio? I'm currently running 1.46.1. The Azure Data Studio - Overview page in MS Learn shows that Azure Data Studio supports SQLCMD in the Query ...
Simon Elms's user avatar
  • 20.4k
0 votes
0 answers
104 views

I'm trying to execute a query in SQL Server 2019 (v15) and facing an issue. The replace works well in SSMS, while it doesn't when the same query is executed in sqlcmd Actual Query SELECT RTRIM(...
udaikp's user avatar
  • 43
0 votes
0 answers
281 views

I want to make a backup of SQL Sever database. Using sqlcmd I am able to direct output to a shared folder on my local machine. I can make a back-up to a location on the server but I cannot direct the ...
Marked's user avatar
  • 182
1 vote
1 answer
495 views

When I run this provisioner it gives me error: exit status 2. Output: Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : Login failed for user 'User'.. │ /bin/sh: 2: Syntax error: "(" ...
Michael's user avatar
  • 184
-1 votes
1 answer
325 views

Given: Backup from Windows SQL Server 2022, containing a database with dashes in its name 1> RESTORE filelistonly FROM DISK = '/tmp/my-awesome-database_FULL_20230810_000209.bak'; 2> go ...
snuk182's user avatar
  • 1,072
0 votes
1 answer
95 views

I am using Vagrant to create a reproducible environment for work. In my vagrantfile I have the following: config.vm.provision :shell, path: "./dependencies.ps1" config.vm.provision :shell, ...
fhevol's user avatar
  • 1,016
0 votes
2 answers
427 views

I am using sqlcmd command to export a SQL Server table to CSV file. sqlcmd -S EC2AMAZ-5UNBD90 -d miadmfggp_live -Q "SELECT SDESC FROM dbo.pmdocs WHERE HMY=95613900;" -s "," -o &...
Yang L's user avatar
  • 469
0 votes
0 answers
200 views

I have 2 docker containers, one with sqlexpress and one with my asp.net app. Both of these containers are in the same network and see each other. I can connect to the database from the host machine ...
Paul Vinogradov's user avatar
1 vote
2 answers
350 views

I need to execute this command: SQLCMD -d dbname -i sc.sql to run some queries. Since I have both version 2019 and 2016, the query is executed with 2019, but actually I need that on 2016. I have the ...
lady's user avatar
  • 376
-4 votes
1 answer
205 views

I use SQLCMD to import DDL generated by mssql-scripter and i got this error: The offending INSERT is the following: INSERT [dbo].[Settings_ContentPartFieldDefinitionRecord] ([Id], [Name], [Settings],...
lfassio's user avatar
  • 23
-2 votes
1 answer
123 views

I am trying to identify how osql and sqlcmd resolve server name and user to connect to that server when we do not specify server using -S option and use -E option. Below is the output for various ...
Sachin Kumar's user avatar
0 votes
1 answer
2k views

My task is to execute Azure MI database SP using Powershell. I am using connection string. I believe I am able to login to the SQLMI database using the connection string with PowerShell. However, I am ...
user112359's user avatar

1
2 3 4 5
24