The sqlcmd tag has no wiki summary.
1
vote
2answers
113 views
SQLCMD command is not able to insert accents
I am trying to run sqlcmd.exe in order to setup a new database from command line. I am using SQL SERVER Express 2012 on Windows 7 64 bits.
Here's the command I use:
SQLCMD -S .\MSSQLSERVER08 -V 17 ...
2
votes
1answer
41 views
FOR XML is generating a empty first line
I'm parsing with flash a XML file generated by this code:
:XML ON
USE MyDatabaseName
GO
SET NOCOUNT ON
SELECT * FROM ProgramacionDia as programa order by hora
FOR XML AUTO,
ROOT ('toflash'),
...
3
votes
1answer
60 views
Named Pipe Provider Error code 40
I have literally tried everything, from enabling named pipe to adding exception to ports in the firewall, to everything possible in surface configuration. I can connect to the SQL instance(using TCP ...
1
vote
0answers
170 views
Network issues with sql server
There are two servers on co-location. First is Windows Server Standard 2008 R2 SP1. Second is Windows Server 2012 + Sql Server Standard 2012 SP1.
First server has a task with a report against tables ...
3
votes
3answers
197 views
Is there a way to tell SQLCMD not to output rows to text or a file?
I am testing the behavior of a SELECT statement that returns 170,000,000 rows using SQLCMD. My goal is to cut out the time spent receiving the result-set on the client end (the time the process shows ...
3
votes
1answer
169 views
sqlcmd: no rows affected
When I run exec dbo.subprogram from SQL Server Management Studio, it executes and returns result as many rows affected.
But when I run from cmd
C:\Users\mssadmin>sqlcmd -S servername -d ...
3
votes
1answer
246 views
Executing TSQL script generated from SSMS in SQLCMD. Failing on quotes
I am attempting to deploy a database to a machine by executing a script generated by the "Generate Scripts" tool in SQL Server Management Studio.
Here is the command I've issued:
sqlcmd -S ...
0
votes
1answer
96 views
Is it possible to generate table with generated data without manual INSERT statements?
Is it possible to use SQLCMD in SQL Server 2008 to create a table and generate data and insert into the table, without manually typing the INSERT statement for each row?
Example:
Suppose there are ...
0
votes
4answers
197 views
Writing SQL statement in sqlcmd to hide the milliseconds for column type of time
I have a table called testtable that have a column named expire_time of type [time]
The problem is that when I type the following in sqlcmd:
select * from testtable
It will return the following:
...
5
votes
1answer
247 views
Query performance while using sqlcmd [duplicate]
Possible Duplicate:
Running queries with SQLCMD vs. Running queries with SSMS
I have a number of scripts that query the data from different tables and consequently update them. I have ...
2
votes
1answer
563 views
How to modify a stored procedure using SQLCMD for MS SQL?
Suppose a stored procedure as follows have been created using the Microsoft SQL Management Studio.
use testbase
go
create procedure testtable_pricesmaller
@pricelimit money
as
select * from ...
2
votes
2answers
196 views
Are there any way to stop typing 'go' in sqlcmd?
If I remember correctly, last time Microsoft Sqlcmd require each command to end with ';' and hit Enter key to execute the command.
However, currently, we need to type the GO each time to execute the ...
1
vote
1answer
123 views
Database created in sqlcmd but missing in SQL Server Management Studio
I created a database named testbase in sqlcmd in SERVER\MSSQLSERVER. However, I cannot access SERVER\MSSQLSERVER.
I also could not find testbase inside the server connection using Microsoft SQL ...
2
votes
2answers
135 views
How can I test sql scripts intended to run with sqlcmd -v in Sql Server Management Studio
From msdn I learn, that the Variable Precedence of :Setvar X Y is higher, than that of sqlcmd -v X=Y.
I want to write a script, that uses the variables supplied to sqlcmd with the -v option, but ...
1
vote
2answers
494 views
Database table data transfer between different servers using bcp.exe and mysqldump
I have 2 servers, both are exact clones of another, one is PRODUCTION live use and the other is strictly for backend DATAENTRY.
Using MSSQL on two different servers I am using the following command ...
3
votes
2answers
403 views
Suppress SQLCMD messages
Would it be possible to suppress all sqlcmd messages output to the cmd window?
I am running a large script and it seems to be slowed down a lot with all the Processed XXXX total records messages.
...
3
votes
1answer
360 views
Running queries with SQLCMD vs. Running queries with SSMS
I've noticed something which i'm not sure about. can it be that running queries directly with SSMS is much faster than running queries with SQLCMD? I've noticed that the results of queries that ran ...
4
votes
3answers
378 views
How to transfer files at remote location using sql server job?
I have a job configured in which it transfers the file at remote location.
My command is running absolutely fine from the command prompt but when I configured it in sql server job it gives log on ...
2
votes
0answers
158 views
How to get SQLCMD to output errors and warnings only?
How can you get SQLCMD, when executing a SQL script file, to just output any errors or warnings it encounters?
I essentially dont want information based messages to be output.
3
votes
1answer
2k views
Why does sqlcmd -Lc not show the local instance?
I have two machines, each with a default instance of SQL Server 2008 installed; each exhibiting a different behavior.
On PC1, when I run sqlcmd -Lc, I do not see PC1 in the list of SQL servers on ...
2
votes
1answer
426 views
Sql Server 2005 - sqlcmd with output to shell and file
I do some command line batch (.bat) with sqlcmd as this way:
sqlcmd -i Scripts\STEP01.sql -o PROCESS.log -S MYSERVER -E -d MYDATABASE
and i need an output file (it's works currently) and also the ...
2
votes
2answers
421 views
Running a number of .sql files using SQLCMD
I'm trying to put together a batch file to run a large number of .sql files without doing so individually.
So far I have:
@echo off
echo "Enter Server"
set /p SERVER=
echo "Enter Database"
set /p ...
0
votes
1answer
574 views
attach database - verify - detach from a script or a batch file
for a hundred good reasons .... and I promise that at least a few are good ... I find myself with almost 200 SQL server databases (mdf,ldf files) generated by different versions of sql server, most ...
3
votes
1answer
571 views
Restoring SQL Server Database Command Line Error
I have a restore database script in a SQL file, and I'm trying to restore a backup generated from one DB to a new DB (that exists). That SQL file is being executed by SQLCMD on the command line. The ...
1
vote
2answers
388 views
Are there any reasons not enable SQLCMD-mode as default in SSMS?
I don't consider "just to ensure that sqlcmd-mode is not required by a script" a valid reason.
Any things to think of before giving the order to enable this setting to my coworkers?
4
votes
1answer
880 views
sqlcmd to run large SQL file causes high CPU usage
I am using sqlcmd.exe to run a large SQL script, and the server CPU usage has been at 100% for the past 5 hours. The SQL script file has a size of 156 MB. I am running the script on SQL Server 2005. ...
3
votes
0answers
653 views
Which workarounds exists to missing relative path feature of SQLCMD :r?
I'm not the first to notice the lack of this feature.
But I wonder if there are some useful workarounds.
I want to deploy a main script and some depended scripts in the same folder.
BTW Is there a ...
2
votes
1answer
112 views
SQLCMDMODE from SSMS. Can I set -b mode when using :r to include files?
As far as I read msdn there is no variable that corresponds to the -b flag of the command (on error batch abort).
I found no to enable this mode inside a script when running in sqlcmd mode.
Is there ...
6
votes
2answers
2k views
Can I enable SQLCMD mode from inside a script?
Is there something like a directive which I can use in a script to force SSMS to enable/disable SQLCMD mode?
10
votes
6answers
634 views
Did anybody use sqlcmd mode in practice? [closed]
SQLServer 2005 introduced something called SQLCMD Mode msdn link.
At first glance this mode adds variable subsitution from command line batch files, and some escaping to OS commands.
Is this ...
12
votes
2answers
11k views
How to pass in parameters to a SQL Server script called with sqlcmd?
Is it possible to pass parameters to a SQL Server script? I have a script that creates a database. It is called from a batch file using sqlcmd. Part of that SQL script is as follows:
CREATE DATABASE ...
