Sorry if this is a duplicate post, but my previous reply never did appear ...
We are running Meditech C/S 5.64.21
In a separate database (named dba) which I created on the same SQLServer as livedb, I created the following view which has helped me identify where data is.
Sadly, there are no foreign keys in the schema since all data integrity is supposed to be assured within the Meditech application/module
View uses three tables, the obvious two (SysDrTables and SysDrColumns) as well as SysStorage which contains number of rows by table by date. This table adds a row for each DR table each day.
I don't really know of any quick way of becoming familiar with the schema except to locate equivalent data pointers in Meditech using Shift-F9. This will show the NPR as well as the DR identifiers.
Understanding a little about the Meditech processes themselves also helps. In the end, trial & error methodology along with a lot of persistence and some of the examples from Meditech's DR Repository and their ARRA Stage 1 measure queries. Note that the ARRA queries may not reflect your specific architecture/processes.
create view [dbo].[pmap] as
select
t.Name tablename,
c.Name columname,
c.DataType + '(' + rtrim(convert(char,c.Length)) + ')' datatype,
c.ColumnPosition colpos,
case c.SortKey
when 0 then ' '
else rtrim(convert(char,c.SortKey))
end sortkey,
t.Keylevel tabletype,
DataPages dpages,
IndexPages ipages,
RowsRW trows,
t.Application _app,
t.TableID _tableid,
c.NprDpm _dpm,
c.NprSegment _segment,
c.NprElement _element
from
livedb..SysDrTables t
join
livedb..SysDrColumns c on t.TableID = c.TableID
join
livedb..SysStorage s on t.TableID = s.TableID
and
DateTimeID = (
select
max(DateTimeID)
from
livedb..SysStorage)
Hi everyone, I’m happy to find a Meditech Dr group for people working with SQL tools out of DR data.
I have two years experience in Meditech and many as programmer.
I agree is frustrating to find out that there are not foreign keys or table relations in any way, and a common practice is to use the “Shift-F9” (Shift-F8 in Magic) shortcut to find out what table/field we need to use.
I created a couple of stored procedures that help me to find what I’m looking for.
The first I called “BRHS_FieldSearch” It receives two parameters @String and @Module
@String it receive a fragment of the name of the field I’m looking for.
@ModuleL it receive a coma separated list of the Modules (Applications) that we want to be search (e.g., 'adm,abs,rad')
(a list of Applications can be obtained by running “Select DISTINCT a.Application FROM SysDrTables AS a ORDER BY a.Application”)
Example: If you execute...
EXECUTE Livendb.dbo.BRHS_FieldSearch 'discharge','adm, abs'
The result will be 1061 rows with: