sql - sys.columns shows details but table missing from sys.tables -


I wanted to know which table contains a certain column in the database. That's why I used sys.column with a condition, and it gave me some object_id.

Select from

Next I went about finding the actual name of this table from the object_id received from the above query , As follows from sys.tables but my selection statement returns empty results. Does this mean that there is no such table in the database? If so, how sys.column is saying that column I with this object_id table I am looking for a lie? Select

  from sys.tables where object_id = '584895884'  

I am using Microsoft SQL Server 2014.

This means that it is not a table, but either a view, or a table-value Use one of the functions, or many other types of objects, instead:

  SELECT. From sys.objects WHERE [object_id] = 584895884;  

Please note that the [object_id] field is a number, not a string, so should not be cited.

You can also do this in a single query:

  SELECT. Sys.column sc INNER from sys.objects so on. [Object_id] = sc. [Object_id] where NAMIIC% 'such as scan.  sys.objects  from   

type and type_desc fields will indicate what type of object is my column The possibilities that appear in one of the databases are:

type_desk (type)


CLR_TABLE_VALUED_FUNCTION (FT)
interlabel (IT)
SQL_INLINE_TABLE_VALUED_FUNCTION (IF) < Br> SQL_TABLE_VALUED_FUNCTION (TF)
SYSTEM_TABLE (S)
TYPE_TABLE (TT)
USER_TABLE (U)
View (V)

sys Tables in the system view only the object type U / will be USER_TABLE .


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -