Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2010
    Posts
    11

    Unanswered: Overriding System data types with User-Defined Data Types with the same name.

    Is it possible for SQLServer to automatically override a System Data Type with a User-defined datatype when creating a table, adding a column, etc by default?

    Currently, if I create a table as follows: CREATE TABLE XYZ(X DATE), it picks up the System Data Type "DATE". However, I also have a User-defined datatype called dbo."DATE" which I want the system to use instead. How can I achieve this without pre-qualifying DATE with dbo. Ie. CREATE TABLE XYZ(X dbo.DATE).

    Thanks.

  2. #2
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    From MSDN: CREATE TABLE (Transact-SQL)
    If type_schema_name is not specified, the SQL Server Database Engine references type_name in the following order:
    The SQL Server system data type.
    The default schema of the current user in the current database.
    The dbo schema in the current database.
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

  3. #3
    Join Date
    Dec 2010
    Posts
    11
    Thanks, but is there any way of overriding the default sequence?

  4. #4
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    Provided Answers: 11
    I don't believe there is a way to override the system data type. In fact, to keep things clear, it is probably best to avoid using the same names as the system data types. I would hate to troubleshoot something like that at 2:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •