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
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Accessing Dos variables using SQLCMD

Author  Topic 

Scoby
Starting Member

3 Posts

Posted - 2010-02-26 : 09:43:43
Hi,

I'm trying to pass a dos environment variable into a stored procedure using the SQLCMD function.
I can get the code to display the variable to the screen with the command.


!!echo "%path%"


But when i try to set it to a variable to be used as input to the stored procedure it errors out. This is the code i'm using


:setvar VNAME "TEST"

:setvar VVALUE $(!!echo "%path%")

use MyDB
go
execute EnvTest_Insert @varName=$(VNAME),@varValue=$(VVALUE)
go


Any help on this would be great

Scoby
Starting Member

3 Posts

Posted - 2010-03-02 : 08:31:48
bump
Go to Top of Page
   

- Advertisement -