Written by

Senior Cloud Architect at InterSystems
MOD
Article Eduard Lebedyuk · Mar 22, 2016 1m read

View stream properties in SQL

Stream datatypes are not displayed when you execute SQL (in SMP for example).

The following query (SAMPLES namespace):

SELECT TOP 2 ID, Notes FROM Sample.Employee

Produces this output:

ID Notes
101 1%Stream.GlobalCharacter^Sample.PersonS
102 3%Stream.GlobalCharacter^Sample.PersonS

To get around that use SUBSTRING operator:

SELECT TOP 2 ID, SUBSTRING(Notes, 1) FROM Sample.Employee

It produces much more useful output:

ID Notes
101 Juanita used to work at TelePedia Inc. as a(n) Associate  Manager
102 Danielle used to work at MetaTel Corp. as a(n) Assistant WebMaster

To limit the length of the stream property  use three argument form:

SELECT TOP 10 ID, SUBSTRING(Notes, 1, 100) FROM Sample.Employee 

In this example only the first 100 characters from a stream would be returned.