InterSystems FAQ rubric
It can be obtained with a List query of the %SYS.Namespace class.
1. Create a routine like this:
getnsp
set statement=##class(%SQL.Statement).%New()
set status=statement.%PrepareClassQuery("%SYS.Namespace","List")
set resultset=statement.%Execute()
while resultset.%Next() {
write resultset.%Get("Nsp"),!
}
quit
ObjectScriptObjectScript
2. Run it in your terminal
%SYS
DOCBOOK
SAMPLES
USER
The method of executing class queries introduced in this article can be applied in a variety of cases.
You can see various class queries in the class reference. For example,
%SYS.DatabaseQuery: GetFreeSpace() Free space in database
%SYS.GlobalQuery: DirectoryList List of global names in database
%SYS.GlobalQuery: Size Size List of global sizes in database
%SYS.ProcessQuery: SS Process information (same as the list that can be confirmed by the ^%SS utility)
and so on.
There are many other options available, so please feel free to use them.
Another option in one line:
do ##class(%SYS.Namespace).ListFunc().%Display()
Basically the same as Enrico's:
LATEST:USER>set result = $system.SQL.Execute("select * from %SYS.Namespace_List()")
LATEST:USER>do result.%Display()
Nsp Status Remote
%SYS 1 0
B360 1 0
USER 1 0
3 Rows(s) Affected
Local:
Do ##class(%SYS.Namespace).ListAll(.result)
you may run the below if needed:
%SYS> zw ^%SYS("Ensemble","RunningNamespace") This will get for you currently running Namespaces
%SYS> zw ^%SYS("Ensemble","InstalledNamespace") This will get current configured Namespaces
%SYS> zw ^CONFIG("Namespaces") This will get current configured Namespaces with the configured globals/routines databases.