error on cmd split when dbname contains _
Posted on 2013-05-28
When I try to execute the following command, an error occurs if dbname contains _ :
$LIST_DBM = (&sqlcmd -E -S $server -d master -h -1 -W -b -Q " set nocount on;SELECT DB_NAME(database_id) +'|'+ mirroring_role_desc +'|'+ mirroring_state_desc FROM sys.database_mirroring WHERE mirroring_guid IS NOT NULL;")
$DB_NAME = $LIST_DB.split("|")
Method invocation failed because [System.Object] doesn't contain a method named 'split'.
How can I resolve this problem?