Read Dynamics NAV Table Metadata with SQL

前端 未结 3 567
南方客
南方客 2020-12-10 08:26

I would like to be able to read the Dynamics NAV 2013 Table Metadata directly from the SQL Server database without requiring the NAV Development Environment.

I can v

3条回答
  •  渐次进展
    2020-12-10 08:45

    It is possible to extract metadata from this table through Nav and as I can see it is stored as plain text but in binary field. It can be saved to file using simple MemoryStream (in Nav it is called OutSteram). So for table number 3 I get following XML:

    
    
        
            
            
            
            
            
            
        
        
            
        
        
            
        
    
    

    Suppose this is what you want.

    Code writing it to file in Nav will look like this:

    ObjectMetadata:Record(Object Metadata)
    Code:BigText
    File:File       
    CodeStream:InStream     
    FileStream:OutStream        
    
    ObjectMetadata.INIT;
    
    IF ObjectMetadata.GET(1,3) THEN
     BEGIN
      ObjectMetadata.CALCFIELDS(Metadata);
      File.CREATE('C:\temp\Code.txt');
      File.CREATEOUTSTREAM(FileStream);
    
      clear(codestream);
      ObjectMetadata."Metadata".CREATEINSTREAM(CodeStream);
      Code.READ(CodeStream);
      Code.WRITE(FileStream);
    
      file.close();
     END;
    

    Now you have options: try to do same thing in SQL/.Net (I'm not keen with it) or you can ask your Nav developer to make some kind of batch job that will periodically (or on demand) process all tables' matadata and save it to external table/file/whatever which you can access from SQL.

提交回复
热议问题