Skip to main content

All Questions

Tagged with
0 votes
1 answer
58 views

No logins showing under SQL Instance as admin and SA

I have an issue where when I log into SSMS I am not seeing any logins. I am running as an administrator and logging in with SA. It does not matter which account I log in with. I only ever see the two ...
Brandon Oisten's user avatar
0 votes
1 answer
594 views

"Fatal scripting error" when parsing SQLCMD query

Similar issue seen here. I am trying to run the following command from SSMS running in SQLCMD mode. :r C:\dev\test scripts\sample.sql But I get the following error: A fatal scripting error occurred. ...
mft25's user avatar
  • 111
2 votes
2 answers
417 views

In SSMS, are IntelliSense and SQLCMD mode mutually exclusive?

In SSMS, are IntelliSense and SQLCMD mode mutually exclusive? Is there any way to make IntelliSense work when SQLCMD mode is enabled? (I use SQLCMD a lot) I'm trying to understand why IntelliSense ...
spinjector's user avatar
4 votes
2 answers
3k views

using SQLCMD to export/extract data withot trailing spaces

I am trying to extract data from some of my tables using sqlcmd utility as SSMS does not generate appropriate csv-s for me. My issue: all csv extract includes trailing spaces according to table ...
Oliver76's user avatar
3 votes
2 answers
15k views

How to print results in SQLcmd window

I'tm trying to show in SQLcmd window the results of these queries: SELECT SYSDATETIME() AS "date"; PRINT 'EXTRAÍDO POR:' SELECT SUSER_NAME() AS "Owner" PRINT 'PASSWORD SETTINGS'; exec ...
Lucas's user avatar
  • 33
0 votes
2 answers
771 views

Are the switches for the SQLCMD command case sensitive?

I have MS SQL Server 2014 Management Studio installed on two computers, both of which run on Windows 10. The switches for SQLCMD command are case-sensitive on one computer, but it is not on the other ...
susmithsuresh86's user avatar
4 votes
1 answer
3k views

SSMS generated script failing to execute

So I am in a situation where I need to import a small DB (under 1GB) from a newer version of SQL Server (I am restoring to a 2014 SQL Server from a 2016 SQL server), without a direct connection ...
Will's user avatar
  • 43
2 votes
1 answer
379 views

Using SQLCMD with Variables

Im trying to do some general script that i can use to run the same INSERT/UPDATE or DELETE statements on different site databases. This was my first attempt which works just fine, but i have to copy ...
mortenstarck's user avatar
8 votes
1 answer
4k views

What are valid connection strings for SSMS login box?

What are valid connection strings for SSMS login box? Every once in a while I will have to connect to an instance of SQL Server with some specific configuration setting or in a DMZ where no host ...
John K. N.'s user avatar
2 votes
0 answers
899 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 ...
Michael Fields's user avatar
12 votes
4 answers
7k views

How do I get SSMS to use the relative path of the current script with :r in sqlcmd mode like SSDT does?

If I have foo.sql and bar.sql in the same folder, foo.sql can reference bar.sql when run from SSDT in sqlcmd mode with :r ".\bar.sql". However, SSMS won't find it. Procmon shows SSMS is looking in %...
Justin Dearing's user avatar
2 votes
1 answer
3k views

SQLCMD mode: environment variable syntax?

I assume the best way to set my SSMS (SQL Server 2005) output file path during runtime of T-SQL, is to use SQLCMD mode. How do I use environment variables (e.g. %systemroot%) in the code? The ...
Relaxed1's user avatar
  • 123
9 votes
1 answer
3k 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 ...
munroan's user avatar
  • 93
1 vote
1 answer
603 views

Database created in sqlcmd but missing in SQL Server Management Studio [closed]

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 ...
Jack's user avatar
  • 2,519
3 votes
2 answers
836 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 ...
bernd_k's user avatar
  • 12.3k

15 30 50 per page