I recently upgraded from SQL Server 2017 Express to SQL Server 2019 Express and installed Microsoft SQL Server ODBC Driver 18. However, a sqlcmd script to back up all databases, using Ola Hallengren's maintenance solution, still wants to use Microsoft ODBC Driver 17. I uninstalled Microsoft ODBC Driver 17 for SQL Server. Now I am getting the below error when I run the script in a .cmd file via the Windows Task Manager.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Data source name not found and no default driver specified.
How can I get sqlcmd to use the Microsoft SQL Server ODBC Driver 18?
-
I installed the 64-bit version of Microsoft ODBC Driver 18 for SQL Server.Mike Pace– Mike Pace2022年07月23日 03:26:53 +00:00Commented Jul 23, 2022 at 3:26
-
If you opens a cmd with administrator rights, th sqlcmd runs?Rodrigo– Rodrigo2022年07月29日 10:46:16 +00:00Commented Jul 29, 2022 at 10:46
-
Yes, but it throws the error listed above if Microsoft ODBC Driver 17 for SQL Server is not installed. I want it to run with Microsoft ODBC Driver 18 for SQL Server.Mike Pace– Mike Pace2022年07月31日 12:16:55 +00:00Commented Jul 31, 2022 at 12:16
-
SQLCMD requires the driver version mentioned in the error message (Microsoft ODBC Driver 17). As @SeanGallardy mentioned, make sure 32 and 64 bit versions are installed.Dan Guzman– Dan Guzman2023年05月06日 01:58:35 +00:00Commented May 6, 2023 at 1:58
2 Answers 2
This is the documentation that specifies the sqlcmd requirements:
This component requires both the built-in Windows Installer 5 and the Microsoft ODBC Driver 17 for SQL Server.
The sqlcmd script absolutely will not run Microsoft ODBC Driver 18 for SQL Server. So I am sticking with Microsoft ODBC Driver 17 for SQL Server. So be it.
Explore related questions
See similar questions with these tags.