1

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?

David Browne - Microsoft
49.2k3 gold badges53 silver badges102 bronze badges
asked Jul 22, 2022 at 18:26
4
  • I installed the 64-bit version of Microsoft ODBC Driver 18 for SQL Server. Commented Jul 23, 2022 at 3:26
  • If you opens a cmd with administrator rights, th sqlcmd runs? Commented 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. Commented 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. Commented May 6, 2023 at 1:58

2 Answers 2

1

This is the documentation that specifies the sqlcmd requirements:

sqlcmd utility

This component requires both the built-in Windows Installer 5 and the Microsoft ODBC Driver 17 for SQL Server.

answered Jul 19, 2023 at 16:49
0
0

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.

answered May 7, 2023 at 12:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.