i am migrtaing database from sql server 2008 to te

2019-08-28 20:20发布

问题:

I am migrating a database from Sql Server 2008 to Teradata and I am facing a problem:

In Sql Server in the ddl of a table column is defined as follows:

[rowguid] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT [DF_Address_rowguid] DEFAULT (NEWID())

This column uses newid() function to generate and insert random varchar value in the column [rowguid] if the user doesnt provide any input.

There is no similar function in Teradata to generate this value.

What can be used instead of of NEWID() function of Sql Server while creating similar table ddls for Teradata?

回答1:

There is no native equivalent for a GUID/UUID in Teradata. Teradata does offer an IDENTITY column to provide an auto-incrementing column. The IDENTITY column does not come without its own nuances and I would encourage you to read the Chapter 5 - Create Table in the SQL Data Definition Language - Detailed Topics which has a section explaining Identity Columns.

However, as part of your migration from SQL Server to Teradata you will need to understand the concept of how data is distributed in Teradata by means of the table's primary index. This may require that you review your existing data model and re-engineer how it is physically implemented in Teradata.