Can in-memory tables be added to a database diagram - sql-server

I have a SQL Server 2016 database with in-memory tables. I'd like to use the database diagram feature to create a graphic to match.
Running SSMS 18.3.1. When I start a new diagram, the in-memory tables are not shown in the drop down. Is there another way to get them on the diagram?
Note: In the official documentation these are called memory-optimized tables. See Introduction to Memory-Optimized Tables

You can't add OLTP object in Database Diagram, not in even in SQL Server 2019.
I thought there should be a way to modify [definition] column in [dbo].[sysdiagrams] but it is HexString of unknown file type. (I tried many formats but its obviously an internal Microsoft type)
Unfortunately, there is no reference to mention that is a not-supported feature. (I send a comment to this page )

OLTP is not supported for database diagram. You do not have access to in-memory tables in the diagram because the diagram does not recognize the essence of a in-memory tables as a table, in fact SQL Server generates a DLL for each created Memory-Optimized Table Type that includes the functions required
for accessing the indexes and retrieving data from the related Memory-Optimized Table Variable

If you run the SQL Profiler tool you'll see there is a column name IsMemoryOptimized in the table data result set that is returned for the memory-optimized table. I think since the Database Diagrams functionality is older (since mssql 2000) and not updated regularly it does not support viewing the newer memory-optimized tables.
more info here:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/71aa7b6e-c281-4417-8149-2eb6f3830110/sql-server-2016-memory-optimized-tables-not-visible-in-database-diagrams?forum=sqlinmemory

Related

Trying to validate if a SQL Server data model uses temporal tables?

Looks like SQL Server 2008 and later uses the concept of "temporal tables" to manage table data history:
https://learn.microsoft.com/en-us/sql/relational-databases/tables/temporal-table-usage-scenarios
Looks like the following clause is used to accomplish this:
WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.MyTableHistory));
Let's assume that a data model has tables TableX and a TableXHistory and I select the following context menu path to generate a DDL script of TableX:
Script Table as > CREATE to > New Query Editor Window
If the generated SQL script does not have a text reference to "HISTORY_TABLE" then can I say 100% that the history table is not managed as a temporal table? Also, would a temporal table be explicitly displayed in the standard tables directory for the data model? Is there any reason not to use temporal tables in 2018 as opposed to manually created history tables? My first impression is that anyone who creates manual history tables in 2018 is most likely out of date with SQL Server capabilities.
Temporal tables available only from 2016. Technology is not mature yet.
Temporal tables have their own Pros & Cons. Other options should be considered (classic triggers and history table, change data capture, replication, etc.)
The main disadvantages of temporal tables for me:
multiple changes made at the same time are invisible (only one row is returned)
history tables must be located at the same DB
limitation for transactional replication, merge replication is not supported
issues when system time has been changed - no way to know which update was first w/o implementing additional logic (version)
history tables can'be updated w/o disabling versioning
to get net changes you need to query the base table (which is not good).
how to detect which columns are changed? (CDC & triggers can detect that naturally, with temporal it may be very expensive)
...

Systems Table that records all changes to database

I am using oracle database for a web application.
Is there a table inside system database that records any or all changes that occur inside the database?
For example, if I insert a row or update a row, it would record this change inside a table.
Does this kind of table exist inside oracle database?
In mysql there is INFORMATION_SCHEMA TABLES that records everything that occurs inside the database.
Oracle too provides auditing mechanisms for your DB however, the subject is very extensive to be treated in a simple answer, since control can go down to a very fine grained auditing. Take a look at Oracle Documentation on this theme, good luck.

Column check SQL Server

I have a lot of views and tables connected in Microsoft SQL Server. I want to check all the useless columns I have in the native tables. Is there a way to perform an automatic check if a column in a table is used or not in other tables?
Create a database diagram in SQL Server Management Studio. From here you can analyze how the tables/columns are related or not. Info here
Do a business model analysis and see which values are used, which are deprecated and start from there.
If you do any changes on the database, these changes have to be projected in any code connecting to that database.
Do not remove columns in tables just by looking at a database diagram. You would destroy any object-relational mapper.

How is Schema defined in Oracle?

I've recently had to do some work on an Oracle database. I come from a MS SQL background. I am still trying to get my head around some basic definitions in Oracle
Schema - to me this just meant the structure of the database. Which includes the structure of the tables, indexes and any constrains. This does NOT include any data that is stored in the tables. A database would only contain one Schema and one set of data.
But in Oracle it seems like a Schema is defined as the structure and the data. And a database can hold many Schemas.
Is that accurate?
Regardless of the database engine, it isn't uncommon to talk about your data model as your "schema". That's not necessarily how any relational database engine defines the term but it may be perfectly clear from the context that you're talking only about the definitions of objects and not the actual data.
In both SQL Server and Oracle, a "schema" is a way of collecting together a bunch of related objects, code, and data. If you define a schema in SQL Server and create a table foo in that schema along with a usp_setFoo procedure, the data that is in foo would be part of that schema. In the same way, an Oracle schema would generally involve table and index definitions, data, code, etc.
Technically, in Oracle, a schema is defined as the set of objects owned by a particular user. Practically, an Oracle schema is generally roughly analogous to a SQL Server "database". Oracle normally has two levels of object naming (schema.object) rather than three levels in SQL Server (database.schema.object). If you're using the enterprise edition of Oracle 12.1 with pluggable databases, that changes things a bit and an Oracle pluggable database can be similar to a SQL Server database.

Database Design and relation diagrams details

We have a production SQL Server and my desktop has SQL Server 2008 R2 Management Studio software installed. I have recently been given a task to perform data mining on our server DBs.
We have around 100 or more of tables there and it is getting very difficult for me to see how tables are related or has been created.
For a particular scenario I have cornered to 3 tables amongst the 100's that we have - but I cannot formulate how these tables are related with each other. I mean if only I know that one's table column is PK / FK of other then only I can execute something like below to extract data's -
SELECT *
FROM tablea,tableb
WHERE tableb.id = tablea.id
and do data mining on the result data set.
Please let me know how can I get all the tables and it relation details? What tool I can use such that further on information like above can be extracted or database designs can be known?
I tried to create the DB diagram but it showed me below error:
Do I need to install any other tool?
Below is my MS SQL Studio version details:
I think your solution is to use a database diagram (https://msdn.microsoft.com/en-us/library/ms189078.aspx)
Just drag all tables on the screen and it will show you the relations, this of course only when the primary-keys/foreign-keys are there.
For the error you are getting:
if I google that for you I get:
The backend version is not supported to design database diagrams or tables
The answer marked as the solution is:
This is commonly reported as an error due to using the wrong version
of SMSS. Use the version designed for your database version. You can
use select ##version to check which version of sql server you are
actually using

Resources