1 /** SECTION END: CLEANUP **/
2
3 create procedure sp_jdbc_getsupertypes(
4 @catalog varchar(32) = NULL,
5 @schemaPattern varchar(32) = NULL,
6 @typeNamePattern varchar(255))
7 as
8 if (@catalog is null) or (@catalog = '')
9 select @catalog = db_name()
10
11 if (@schemaPattern is null) or (@schemaPattern = '')
12 select @schemaPattern = '%'
13
14 if (@typeNamePattern is null)
15 begin
16 raiserror 17208
17 'Null is not allowed for parameter TYPE NAME PATTERN'
18 return (1)
19 end
20
21 select
22 TYPE_CAT = @catalog,
23 TYPE_SCHEM = convert(varchar, b.name),
24 TYPE_NAME = convert(varchar, t.name),
25 SUPERTYPE_CAT = @catalog,
26 SUPERTYPE_SCHEM = 'dbo',
27 SUPERTYPE_NAME = convert(varchar, p.name)
28
29 from systypes t, sysusers b, systypes p
30 where t.uid = b.uid
31 and t.usertype >= 100
32 and t.type = p.type
33 and p.usertype = (select min(usertype) from systypes where type = t.type)
34 and b.name like @schemaPattern
35 and t.name like @typeNamePattern
36
exec sp_procxmode 'sp_jdbc_getsupertypes', 'AnyMode'
go
Grant Execute on sp_jdbc_getsupertypes to public
go