SQLCMD is Microsoft SQL Server's command line utility that allows you execute T-SQL commands from a command prompt.

learn more… | top users | synonyms (1)

4
votes
1answer
87 views

Permission error when executing a 5.6 GB sqlcmd file

I am trying to run a very large file through the sqlcmd command and it works perfectly with files of 100 MB up to 1.4 GB. This is what I have tested so far, but when I try to run a file which is 5.6 ...
3
votes
1answer
199 views

SQLCMD stuck on “set textsize 4096”

I am using SQL Data Compare to generate a script that updates data in a QA database (SQL Server 2012). The script is around 500mb and I added a GO every 100 lines. When I start the script with: ...
1
vote
1answer
68 views

Test SQL Server connection with sqlcmd using machine name

How can I test a connection via machine name as the SQL logon name (ie mydomain\server01$ - as an IIS AppPool would connect) using sqlcmd? I'm having trouble figuring out an application's SQL Server ...
1
vote
1answer
110 views

With LocalAdmin become sysadmin SQL Server

I am a local Admin on my machine. Same old thing, my account wasnt added when SQL Server was installed, and I don't want to have to reinstall SQL Server. I went through this blog and it worked until ...
1
vote
1answer
55 views

Verify failed SQL Server connections to instances on a given server and email them

I am trying to monitor the SQL Server instances on standalone server / cluster server. I would like to setup something from commandline to check for connectivity to each SQL Server instance on the ...
2
votes
0answers
53 views

SQLCMD -L Returns Bizarre Response Instead of Server List

I have a server with three installed SQL Server 2014 instances with Service Pack 1 (build number is 12.0.4213.0) installed. When I run SQLCMD -L on the server I am getting the bizarre response below. ...
1
vote
0answers
104 views

Using :Connect I keep getting msg 911 - database [dbname] does not exist

I have a two part T-SQL script, the first part runs against a database on a different server, the second part is supposed to run on the local PC. I'm using SQLCMD mode and the :Connect keyword but ...
1
vote
0answers
246 views

Executing shell commands from SSDT Post Deploy scripts to generate SQL

tl;dr: I'm looking for the equivilant of !! sqlcmd -S $(Server) -o foo.sql -d $database -Q "EXEC sp_generate_merge 'table_name'" in a SSDT post deploy script, but !! doesn't seem to be supported. I ...
1
vote
0answers
1k views

SQLCMD cannot find the SQL Server remotely

I am trying to use SQLCMD to remotely detach a database but for some reason it can't find the server. From the workstation, I can connect to the database instance (which is the default instance) using ...
1
vote
0answers
908 views

SQL Server, I can execute sqlcmd with trusted connection but not sqlpackage

We have some deployment scripts that use a combination of dacpacs through sqlpackage and straight scripts using sqlcmd. When I execute the sqlpackage dac\sqlpackage.exe /p:BlockOnPossibleDataLoss=...
1
vote
0answers
376 views

sqlcmd returning NUL instead of NULL for tinyint column

sqlcmd -E -d MyDatabase -Q "sp_helpsubscription" -s "," -o file.csv -W -u Column 23 which is suppose to be a tinyint (subscriber_type) is output as NUL instead of NULL when the value is NULL. I ...
0
votes
0answers
8 views

sqlcmd on Azure SQL Data Warehouse - SqlState 24000, Invalid cursor state after INSERT statement

I am working on a script to reload a table using SQLCMD on Linux connecting to an Azure SQL Data Warehouse database. After the INSERT statement completes, the next statement fails (but does not end ...
0
votes
0answers
31 views

sqlcmd returning literal 'NULL' for null columns when outputting to CSV

I'm using sqlcmd (SQL Server 2008 R2) to execute a simple query to output data to a .csv file. In the SQL file, I have the following code: USE [OSCAR_UK] SELECT DISTINCT ISNULL(LTRIM(RTRIM(il.[...
0
votes
0answers
40 views

Calling Knime batch file from Sql Server

We have an ExecutionSenario on daily ETL steps. One of them is to start a batch file of Knime to make an analysis of our data. Our batch seems as working on Task Manager > Process in background but ...