Si encuentras alguna incompatibilidad en tu código o trabajo, recuerda probar siempre en un entorno de testing antes aplicar el código al proyecto final.
Ejemplo 1: obtenga la lista de todas las tablas en SQL Server
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLESWHERE TABLE_TYPE ='BASE TABLE'AND TABLE_CATALOG='YOUR_Database_name'
Ejemplo 2: sql obtiene una lista de dominios y las tablas que los usan
--Queries an sde-schema geodatabase in SQL ServerDECLARE@DOMAIN_NAME NVARCHAR(MAX);SET@DOMAIN_NAME='Material';DECLARE@CLASS_DEFSTABLE(
Name nvarchar(max),
Definition XML
)--Insert records to temporary record setINSERTINTO@CLASS_DEFSSELECT
sde.gdb_items.Name,
sde.gdb_items.Definition
FROM-- Get the domain item's UUID.((SELECT GDB_ITEMS.UUID AS UUID
FROM sde.gdb_items INNERJOIN sde.gdb_itemtypes
ON sde.gdb_items.Type= sde.gdb_itemtypes.UUID
WHERE
sde.gdb_items.Name =@DOMAIN_NAMEAND
sde.gdb_itemtypes.Name IN('Coded Value Domain','Range Domain'))AS Domain
-- Find the relationships with the domain as the DestinationID.INNERJOIN sde.gdb_itemrelationships
ON Domain.UUID = sde.gdb_itemrelationships.DestID)-- Find the names of the origin items in the relationships.INNERJOIN sde.gdb_items
ON Domain.UUID = sde.gdb_itemrelationships.DestID
-- Extract the field definitions.SELECT
ClassDefs.Name AS"Class Name",
fieldDef.value('Name[1]','nvarchar(max)')AS"Field Name",NULLAS"Subtype Name"FROM@CLASS_DEFSAS ClassDefs
CROSSAPPLY
Definition.nodes('/*/GPFieldInfoExs/GPFieldInfoEx')AS FieldDefs(fieldDef)WHERE
fieldDef.value('DomainName[1]','nvarchar(max)')=@DOMAIN_NAMEUNIONSELECT
ClassDefs.Name AS"Class Name",
fieldDef.value('FieldName[1]','nvarchar(max)')AS"Field Name",
fieldDef.value('(../../SubtypeName)[1]','nvarchar(max)')AS"Subtype Name"FROM@CLASS_DEFSAS ClassDefs
CROSSAPPLY
Definition.nodes('/*/Subtypes/Subtype/FieldInfos/SubtypeFieldInfo')AS FieldDefs(fieldDef)WHERE
fieldDef.value('DomainName[1]','nvarchar(max)')=@DOMAIN_NAME
Puedes amparar nuestro análisis ejecutando un comentario y dejando una valoración te damos las gracias.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)