SqlCmd output

Nov 29, 2009 at 5:14 PM

Can I output the result of a SqlCmd to a variable of msbuild instead of a file?

Coordinator
Dec 1, 2009 at 1:00 PM

No, you would have to use the ReadLinesFromFile task http://msdn.microsoft.com/en-us/library/ms164299.aspx

 

 

Dec 1, 2009 at 1:09 PM

Thx Mike, I had figured out about ReadLines.

I think it would be greeat for some scenarios.

Image having to read a file every time you need to output a scalar value.

Is there a features it, I could put this in?

Coordinator
Dec 4, 2009 at 4:56 PM

Hi Yvan, feel free to submit a patch where you have this working.

Regards

Mike

Jan 7, 2010 at 1:44 PM
Edited Jan 7, 2010 at 4:08 PM

I am having some trouble figuring out how to use it. I am doing a select statement to an out file and the results of the file are:

 

                    
--------------------
1.0.1366.373        
(1 rows affected)

 

 

--------------------

1.0.1366.373        

 

(1 rows affected)

How can I read that in but know to only get the line with the version number in it? I'm fairly new to MSBuild and haven't been able to find any documentation on picking certain array elements.

 

 

Coordinator
Jan 11, 2010 at 10:25 AM

Use the SqlExecute task rather. It's shipping in 3.5.5.0, but is checked in now if you want to build it locally.

Draft documentation here: http://www.msbuildextensionpack.com/help/3.5.5.0/html/0d864b98-649a-5454-76ea-bd3069fde8bd.htm