16

SQL Server adds things to my PATH environment variable, and over time that bloat makes me hit the 2048-char limit in Windows 7. Do I really need them there for SQL Server to run? This is on a development machine so I want to have several versions installed. I'm only worrying about normal day-to-day use rather than edge-cases that might arise, i.e. I probably wouldn't do this on a production machine but wouldn't need to as it'd only have one version installed.

For example I have:

c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\
c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\
c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\
c:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\
C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\
c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\
C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\
C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\
C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\
C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\
C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\
c:\Program Files\Microsoft SQL Server\100\DTS\Binn\
c:\Program Files\Microsoft SQL Server\100\Tools\Binn\
C:\Program Files\Microsoft SQL Server\110\DTS\Binn\
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
C:\Program Files\Microsoft SQL Server\120\DTS\Binn\
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\

1 Answer 1

7

In fact, you do not need all the environment variables for each the instance SQL Server. And well, if you check the environment variables needed to install and run queries or tasks.

However, the problem can be solved directly.

SET App32=c:\Program Files (x86)\
SET App64=c:\Program Files\
SET SQL32=%App32%Microsoft SQL Server\
SET SQL64=%App64%Microsoft SQL Server\
SET SQL32IDE=Tools\Binn\VSShell\Common7\IDE\
SET Studio32=Tools\Binn\ManagementStudio\

%SQL32%100\DTS\Binn\
%SQL32%100\Tools\Binn\
%SQL32%100\%SQL32IDE%
%SQL32%110\DTS\Binn\
%SQL32%110\Tools\Binn\
%SQL32%110\%Studio32%
%SQL32%120\DTS\Binn\
%SQL32%120\Tools\Binn\
%SQL32%120\%Studio32%
%SQL32%80\Tools\Binn\
%SQL32%90\DTS\Binn\
%SQL32%90\Tools\binn\
%SQL32%90\%SQL32IDE%

%SQL64%100\DTS\Binn\
%SQL64%100\Tools\Binn\
%SQL64%110\DTS\Binn\
%SQL64%110\Tools\Binn\
%SQL64%120\DTS\Binn\
%SQL64%120\Tools\Binn\
%SQL64%Client SDK\ODBC\110\Tools\Binn\

Hrrr... )))

1
  • I suggest leaving the trailing backslash out of the new environment variables. If you look at existing environment variables, such as %SYSTEMROOT%, they don't have a trailing backslash so paths are similar to %SYSTEMROOT%\System32, rather than %SYSTEMROOT%System32. I think it's best to stick with the same convention to avoid slip ups.
    – Simon Elms
    Jul 2, 2021 at 0:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .