SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQLCMD returns the sql statemetn
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

TRACEYSQL
Aged Yak Warrior

586 Posts

Posted - 12/12/2013 :  11:37:28  Show Profile  Send TRACEYSQL an ICQ Message  Reply with Quote
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

India
52249 Posts

Posted - 12/12/2013 :  12:02:24  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000