Sql Server issue - 'sqlcmd' is not recognized as an internal or external command

+1 vote
asked Aug 8, 2016 by Hitesh Garg (352 points)  

I have a bat file that runs some SQL commands for the SQL SERVER and currently I am using SQL SERVER 2012.
I basically runs commands in two steps, one to drop the existing schema and another to recreate the new schema.
Step one is completed successfully but during the execution of step two i.e. recreate schema part it gives the following error -

'sqlcmd' is not recognized as an internal or external command

What is the possible solution for this problem?

2 Answers

+1 vote
answered Aug 8, 2016 by Rahul Singh (543 points)  
selected Aug 8, 2016 by Hitesh Garg
Best answer

Let us assume that the SQL Server installation is done properly.
If the command prompt returns -

(name of the software) is not recognized as an internal or external
command, operable program or batch file.

this means that the file of software of command is not defined in the %PATH% environment variable.

With this latter it is possible to recall executable applications without defining their full path. Then, to solve this issue you can create an environment variable with the complete location and add it to the path:
On my system I have SQLCMD.exe at location C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn. Please find where it is in your system. To find simply go to SQL Server installation folder and search for sqlcmd.exe.

  1. Control Panel > System > Advanced > Environment Variables
  2. Add a new variable give it a name let say SQLSERVERSQLCMD and add path in the value i.e. C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn.
  3. Find another variable named PATH and add %SQLSERVERSQLCMD% at the end of it.

Hope this helps and solves your problem.

commented Aug 8, 2016 by Hitesh Garg (352 points)  
Thanks, that solves my problem.
+1 vote
answered Sep 10, 2016 by sksanjai (45 points)  

This error occurs when the exe or batch file is not found. To get rid out of this error just add the SQL Server path to system variables

124 questions

41 answers


928 users

Most popular tags

java python python3 oracle database java-8 sql-server python2 oracle11g git oracle-12g command-line maven sql-server-2012 sql input array list fenitoina dilantin javaçš„ angular javascripts git-branch intellij-idea hashmap collection file-io io temovate clobetasol ampicillin principen daclatasvir daklinza vasotec enalapril nexium esomeprazole tadalafil tadlis sildenafil citrate pefomax xeloda capecitabina clobetasol temovate stemetil prochlorperazine methotrexate methotrexate sildenafilo y dapoxetina super kamagra norvasc amlodipine citalopram celexa amitriptylin saroten vitamin b12 methylcobalamin valaciclovir valtrex zudena udenafil sildenafil citrate vigour depakote divalproex retin-a tretinoine sildenafil citrate ip-max nizoral ketoconazol ciaton tadalafil norethisteronacetat aygestin indomethacin indocin tiova tiotropium bromid finasterida proscar lithium carbonate eskalith finasterida propecia levitra vardenafil vantin cefpodoxima loxitane loxapine rulide roxithromycine avodart dutasterid tecnomax sildenafil citrate methylcobalamin vitamin b12 permethrin acticin etinilestradiol norgestrel ovral pk-merz amantadin cycrin medroxyprogesterone serophene clomiphene spironolactone aldactone mesalazin pentasa zebeta bisoprolol cytodrox hydroxyurea ampicillin ampicillin pletal cilostazol paracetamol panadol pepcid famotidina meclizine hydrochloride antivert donaton tadalafil sdf dsfs sdgfgsdg mac null-pointer-exception constructor oracle-12c terminal hibernate-5 hibernate git-merge es6 programming git-amend git-commit java-stream git-remote multithreading access-modifiers nested-classes
Welcome to Codingeek Q&A, where you can ask questions and receive answers from other members of the community.