All Questions
29 questions
0
votes
1
answer
68
views
AzureManaged SQL Dump To Blob Container By SqlPackage
I want to automate azure managed sqlserver dump operation. I can dump the data by sqlpackage tool. But I couldn't find how to push it to blob container. Also I don't want to use az-cli command. Is it ...
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 ...
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"
...
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 ...
0
votes
1
answer
419
views
SQLCMD: Pass parameter database startig with number to script using powershell
From powershell we are running the following command to create a Database. The database name starts with a number:
SQLCMD -S Z0EUW1WLSQL031\PRUEBA -U rdb00001 -P "1234" -v datos="`"...
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 ...
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-...
0
votes
2
answers
6k
views
How to connect to an Azure SQL Server using command prompt?
I have an Azure SQL database that I am able to connect using local SSMS.
Server Name - <Server>.database.windows.net
UserName - zrana
Password - *****
The authentication mode I use is here is ...
0
votes
1
answer
129
views
Batch file script for sqlcmd
I'm looking for a way to make the below commands a bit more automated. I would like to be able to use just a simple batch file if possible.
sqlcmd /S localhost\SQLEXPRESS /U [dbusername] /P [...
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
...
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
...
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,
...
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 ...
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 ...
0
votes
1
answer
423
views
How to deploy database to multiple times with different variables
I'm using Octopus deploy and DacPac to deploy a database twice on the same server.
They have different names and are deployed successfully.
Only in the publish command I give them different values for ...
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 ...
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 ...
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 @...
0
votes
2
answers
1k
views
How Do I Connect SQL Database to Internet?
I have a small program that I made with Java and intend to have it run on any computer that it is downloaded to. Part of this program connects to a MySQL Database that is running on my localhost. ...
0
votes
1
answer
489
views
Populating ms sql with sql files
I already have an existing database I am trying to keep up to date on a daily basis. I get a daily dump of sql files. The batch script below created and populated the database the first time I run it, ...
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 ...
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%
>>"...
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 ...
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:\...
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/...
63
votes
6
answers
40k
views
Conditional logic in PostDeployment.sql script using SQLCMD
I am using a SQL 2008 database project (in visual studio) to manage the schema and initial test data for my project. The atabase project uses a post deployment which includes a number of other scripts ...
1
vote
3
answers
4k
views
Trying to restore a database from a large .sql file using sqlcmd - error
I am trying to restore database data using the following command from a large .sql file
Type myfile.sql | sqlsmd –S server –U username –P password
I get the following error:
Sqlcmd: Error: ...
4
votes
1
answer
5k
views
Dealing with SQLCMD :r in a post-deployment script
We use a Visual Studio Database Project for the source control of the schema of our database. We also want to script certain data (configuration values etc.) from the database, so we use a custom ...
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 ...