I am using following SQL query to get version number from database through a batchfile.
sqlcmd.exe -S localhost -d MyDB
-Q "set nocount on;Declare @VersionNumber nvarchar(128) set @VersionNumber = (select top 1 versionnumbe from Table_schemaversion order by Id desc) print 'Your Previous Version is: ' + @VersionNumber "
This query is working fine, and producing the correct result.
But now I need to store this result into a local variable of the batch file. And I cannot use any external file here, I have to do this by the query written above, only.
How can I do this? Can anybody let me me about a solution to do this?
Thanks in advance.....