I have a few tables that contain ID's that are of type GUID, pretty much every table is using GUID's instead of incremented IDs, but thats neither here nor their, just a scope of what I am dealing with.
So I have a table called MaterialType and MaterialSubType
the MaterialType is built as the following
MaterialTypeID (PK, Uniqueidentifier, not null)
MaterialType (varchar(40), not null)
Code (varchar(100), not null)
EnabledInd (tinyint, not null)
The MaterialSubType is built as follows
MaterialSubTypeID (PK, Uniqueidentifier, not null)
MaterialTypeID (PK, Uniqueidentifier, not null)
MaterialSubType (varchar(40), not null)
Code (varchar(100), not null)
EnabledInd (tinyint, not null)
The problem I am running into is that I have two updated tables that are pretty much identical, other than the fact is that I am using autoincremented ID's, I need to figure out how to query the data from the original tables and insert the data into the new tables.
I know I can do an "insert into select" to the tables, but that doesn't (at least to my knowledge) help me because I need to have a foreign key in the MaterialSubType to the MaterialType.
So I am not sure how this should be done or how to do it, reason being is that I am not an expert with SQL or a DBA.