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
 General SQL Server Forums
 New to SQL Server Programming
 SQLCMD returns the sql statemetn

Author  Topic 

TRACEYSQL
Aged Yak Warrior

594 Posts

Posted - 2013-12-12 : 11:37:28
sqlcmd -S Servername -E "EXEC myprocedure 'myvalue',''" -h -1 -o c:\test.txt -e

the text.txt keeps putting in
exec myprocedure 'myvalue'
DATAVALUE

I only want the DATAVALUE to return

The sp has a return output value and when run it returns just the DATAVALUE, this parts is working

What switch is needed to not write the sql script to text file.


After this is working i wish to read if COMPLETE do this or EXIT


---Anyone got example

set /p myvar=< c:\test.txt
echo The sql variable is "%myvar%"


@rem if "%myvar%"=="" (echo MyVar is Not defined)
@rem else (echo MyVar is %myvar%)


@rem if "%myvar%"==COMPLETE goto start

@rem if "%myvar%"=="" goto cancel


@rem :start
@rem echo start
@rem pause

@rem :cancel
@rem echo cancel

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-12-12 : 12:02:24
Answered here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=184168

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -