Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Help with sql version script

Author  Topic 

MassiveOverkill
Starting Member

20 Posts

Posted - 2008-07-09 : 14:12:45
Can someone help me with this script? I'm missing a quote, comma, or parenthesis somewhere. My instancename has been replaced with (INSTANCENAME) to protect the innocent. Thanks.....Here's the script:

ECHO ON

@ECHO OFF

FOR /F "TOKENS=6 DELIMS= " %%A IN ('"%ProgramFiles%\Microsoft SQL Server\90\Tools\Binn\SQLCMD" -S "127.0.0.1\(INSTANCENAME)" -Q "SELECT @@VERSION"^| FINDSTR /I "SQL SERVER"') DO (SET SQLBUILD=%%A)

ECHO %SQLBUILD%

PAUSE

MassiveOverkill
Starting Member

20 Posts

Posted - 2008-07-09 : 15:08:21
Figured it out:

Thanks ME, I figured it out :p

ECHO ON

SET WORKINGDIRECTORY=%CD%

ECHO %WORKINGDIRECTORY%

CD %ProgramFiles%\Microsoft SQL Server\90\Tools\Binn
@ECHO OFF

FOR /F "TOKENS=6 DELIMS= " %%A IN ('SQLCMD.EXE -S "127.0.0.1\(myinstance)" -Q "SELECT @@VERSION"^| FINDSTR /I "SQL SERVER"') DO (SET SQLBUILD=%%A)

ECHO "%SQLBUILD%"

CD %WORKINGDIRECTORY%

PAUSE
Go to Top of Page
   

- Advertisement -