November 25, 2008 at 6:09 pm
i was working on this and got few questions..please suggest me
there are two tables in adventureworks db..
i)HumanResources.EmployeePayHistory
ii)HumanResources.EmployeeDepartmentHistory
now first i copy the data from both the tables using import/export in an excel file..now i truncate the data from the tables...then i export the data from the excel file..the tables are see n but with schema name as dbo instead of HumanResources...there is a script which can help in changing the schema(found on this website)...but instead of all cant i just get the data the way it was before from the excel file with all the primary keys and foreign keys..please suggest me...
November 25, 2008 at 8:12 pm
From BOL:
Syntax
ALTER SCHEMA schema_name TRANSFER object_name
Arguments
schema_name
Is the name of a schema in the current database, into which the object will be moved. Cannot by SYS or INFORMATION_SCHEMA.
object_name
Is the one-part or two-part name of a schema-contained object to be moved into the schema.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
November 25, 2008 at 9:06 pm
but then i will have to assign the primary keys...foreign keys..and all dat stuff right..thank you for your reply..
November 26, 2008 at 7:09 am
iqtedar (11/25/2008)
but then i will have to assign the primary keys...foreign keys..and all dat stuff right..thank you for your reply..
If all that is already done then I believe it should remain even after the transfer to the new schema.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
November 26, 2008 at 7:29 am
ok kool..i will try and let you know...so u mean to say if i change the schema it will also assign all the primary and foreign keys to the table which it had before...
November 26, 2008 at 7:35 am
If the relationships are already created then changing schemas should not remove them.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply