user3779002
user3779002

Reputation: 620

Where to find user-defined types in table catalogue views

Of sys.objects BL says "Contains a row for each user-defined, schema-scoped object that is created within a database"

The following shows the creation of 2 schema scoped objects, a table and a type, but querying something_here only shows up the table. Why is this, where in the catalogue views do I find this?

use master;
go

create database testtttt;
go

use testtttt;
go

select * -- shows nothing of course
from sys.objects 
where name = 'provider';

create table dbo.provider (x int);

select * -- can see new table
from sys.objects 
where name = 'provider';

-- make type, scoped to dbo
create type dbo.provider from int;

select * -- can see table but not new type
from sys.objects 
where name = 'provider';


use master;
go

drop database testtttt;
go

(select @@version = Microsoft SQL Server 2014 (SP3-GDR))

okay, just before posting this StackOverflow suggested this question Finding SQL Base Type for a User-Defined Type which shows that you can find it by looking in sys.types (tested, it works) except I already looked in the overview of the object catalogue views https://learn.microsoft.com/en-us/sql/relational-databases/system-catalog-views/object-catalog-views-transact-sql?view=sql-server-ver16 and sys.types did not show up there. What's going on, and are there other kinds of things which behave like this?

Upvotes: 0

Views: 86

Answers (0)

Related Questions