Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
324 views

SQL Server don't run in sqlcmd but run in ssms

I have a problem with a script running under sqlcmd vs SSMS. The first time that I had the problem, I cut the large file (a lot of inserts) into small pieces, cutting it in blocks of 2000 inserts. In ...
MCunha98's user avatar
0 votes
0 answers
825 views

How to connect to a remote database with Windows authentication using sqlcmd?

I'm trying to use sqlcmd to execute querys on a remote database but I can´t login When I connect using SSMS i have to use this runas command runas /user:domain\username /netonly "Ssms.exe" ...
Agustín De Cesare's user avatar
0 votes
0 answers
333 views

Writing to disk on mac/linux using SQL Server Command Line tools

My objective is to backup a remote SQL Server database using SQL Server command line tools for Mac (or Linux). After installing the sqlcmd utility, I am able to connect to the database but am not sure ...
iskandarblue's user avatar
  • 7,496
0 votes
0 answers
2k views

Login failed when I trying to connect to a SQL Server using sqlcmd (from Ubuntu command line)?

I am finding some problem trying to connect to a SQL Server instance from an Ubuntu machine using sqlcmd. The SQL server instance run on another server that is an always on MS-SQL Server cluster. So ...
AndreaNobili's user avatar
  • 42.8k
2 votes
1 answer
3k views

Error trying to connect to a SQL Server using sqlcmd (from Ubuntu command line)?

I am finding some problem trying to connect to a SQL Server instance from an Ubuntu machine using sqlcmd. So I installed sqlcmd as explained here: https://learn.microsoft.com/it-it/sql/linux/sql-...
AndreaNobili's user avatar
  • 42.8k
0 votes
1 answer
3k views

AWS RDS SQL Server RESTORE ISSUE

I created SQL Server res instance on AWS. I want to restore the database from a .bak file. I performed below steps in order to restore: sqlcmd -S XXX.rds.amazonaws.com -U root -P XXXX USE master go ...
chitender kumar's user avatar
2 votes
3 answers
9k views

Sql DataReader Has Rows but Returns With Empty data

I am using a query to select data from sql database. It has rows but data raader.Read() function returns false and rows are empty as I have checked in debugging Code that i have been using is ...
kirito70's user avatar
1 vote
1 answer
890 views

How to generate insert statements in a text file (*.sql) using sqlcmd

My operating system is Windows 7. I am working with SQL Server 2008 R2. I have a database MyDB which has a table employee_core which has these columns: employee_id varchar(5), job_class smallint, ...
srh's user avatar
  • 1,661
1 vote
0 answers
300 views

SQL - Calling scripts Error SQLCMD query

So i have been writing a data migration script for the past few weeks and have decided it has become too long and is too hard to edit as one long script. So what i wanted to do was to split it up into ...
Owain Esau's user avatar
  • 1,922
0 votes
4 answers
696 views

How to create a new database in MS SQL Server?

Sorry, if this has been asked previously. In services on a client, I can see that MS SQL Server has the status "started". and on this machine I don't have Microsoft SQL SERVER Management ...
Dax's user avatar
  • 470
17 votes
3 answers
19k views

Cannot connect to LocalDB via sqlcmd

I am currently learning SQL Server and am having problems connecting to my local database using sqlcmd. When I type in the following into Powershell: sqlcmd -S "(localdb)\mssqllocaldb" I get the ...
SQLnewbie's user avatar
  • 171
0 votes
1 answer
588 views

AdventureWorks activation error in SQL Server, I don't know if it is my pathway is wrong or my database is wrong

I'm trying to add AdventureWorks to my SQL Server 2014 Management Studio. After I opened the query in SQLCMD code, I changed the setvar path to my server name. How do I fix this error? I have the ...
Lee's user avatar
  • 21
0 votes
0 answers
2k views

Create Database Without Administrator privilege in Sql Server 2008 R2

As in my organization creating database is restricted and only I do have access for local server with windows authentication(no username and password). When I try to create a database at local server @...
Pradeep's user avatar
  • 189
4 votes
3 answers
28k views

Can't access sqlcmd using username password

I am new to SQL Server. Please help me to fix. I have created a user with password in SQL Server Management Studio (2008 R2). When I use sqlcmd with this user, sqlcmd says C:\Console2>sqlcmd -U ...
user avatar
0 votes
1 answer
1k views

Using sqlcmd to capture the data from a remote server and putting the excel file in some other server

I have used sqlcmd to capture the required data from a remote server ,which is coming fine . I have used the below query in a batch file - >>"Output_hvac.xls" echo %date% %time% >>"...
user1896796's user avatar
2 votes
1 answer
3k views

Renaming SQL Server database from SQLCMD

How can I rename AdventureWorksLT2008 database to AdventureWorksLT2008_old with its .ldf and .mdf files renamed as well? I would like to do it from sqlcmd. It is a local server. I would like to do ...
Aashiq Hussain's user avatar
3 votes
1 answer
769 views

Ant <Sql> and <exec> sqlcmd - Different Outputs

I have one .sql file that is execute using ant, when I execute it with the tag I recived a different output as when i used calling "sqlcmd". sql tag output: [sql] Executing resource: C:\...
Diego Bascans's user avatar
1 vote
1 answer
817 views

How to create object(function) if database name is defined in SQLCMD mode variable?

My SQL looks like this: :SETVAR VAR_DB_NAME DatabaseName.DBO SELECT * FROM $(VAR_DB_NAME).tableName If I try to do: CREATE FUNCTION $(VAR_DB_NAME).FunctionName I'm getting an error: CREATE/...
Sergejs's user avatar
  • 2,580
9 votes
7 answers
13k views

What's the best way to start and stop SQL Server from the command line?

I need to start and stop SQL Server from the command line. I am willing to write a small C# program if necessary, but I suspect that there's something (PowerShell, maybe?) that currently exists that ...
rp.'s user avatar
  • 17.6k