Domains with XML as datatype only work with domain_name XML?

  • 17 August 2022
  • 1 reply
  • 51 views

Userlevel 4
Badge +2

Hi TW forum,

I noticed something interesting and would like to confirm my conclusion. 
I was following the guide for multirow task execution

Now this requires a domain with xml datatype.
When I create the domain with xml as name it all works swimmingly. But when I start using custom names for the xml domain its seems impossible to create that domain?

Am I correct in understanding that a domain with xml datatype only works if it has the name ‘xml’? 
I tried making an anne_xml domain and could not find it in user-defined data types nor in the creation scripts.

Some testing taught me that running the following code 

create type anne_xml from xml
grant references on type::anne_xml to public
go

results in the error:
Cannot create alias types from an XML datatype.

My conclusion its that its technically impossible and the adding of a domain for xml is just so its available in the model?
Which will then translate into to the code as ‘xml’ using the build in data type xml.
I think that’s a pretty cool solution😁


This topic has been closed for comments

1 reply

Userlevel 7
Badge +11

Hi Anne,

Your conclusion is correct.

For a couple of datatypes, like XML, ROWVERSION and FILESTREAM, it is not possible to create an alias on SQL Server.

The Thinkwise Platform does allow you to create a domain for it in you application's model, but no user defined type is created on the database and the domain will automatically be referenced using the base datatype.

We think that's pretty cool too 😎