Posted on 2014-02-03
When executing the below command, the value (Machine Name) isn't being returned and passed into the next command (strQuery2).
strQuery = "SELECT SERVERPROPERTY ('MachineName') "
'strQuery2 = "ALTER DATABASE " & database & " & MachineName & " "
Dim cmdr As SqlCommand
Dim cmd As SqlCommand
cmdr = New SqlCommand(strQuery, con)
MachineName = cmdr.ExecuteScalar()
'cmd = New SqlCommand(strQuery2, con)