Bobby Heid
bheid at sc.rr.com
Tue Mar 27 13:01:35 CDT 2007
John, I do not have an answer for you. But have you looked at doing it in SQL Server Manager and then having it copy the script to the clipboard or a file? I recently took a class in SQL Server 2005 and the instructor showed us how to something and then before closing it/saving it, showed us how to save the script to create the object(s) that we just created in the GUI. Bobby -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Tuesday, March 27, 2007 1:39 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Programmatically creating relationships I am starting the process of migrating a large database from Access to SQL Server. One of the things I have to do is go find all the places where relationships were missed / couldn't be established for some reason and get them in there. I am doing this offline first and being the meticulous guy I am, I want to be able to build up a program that does much of this stuff so that as I document what has to be done, I also have code that will do it the next time. For example, I have written a function that finds orphaned records in a child table and deletes them out. What I need to do next is establish a relationship between the parent / child. I can write that code but have never done so and would use borrowed code if anyone out there has a lib of such relationship oriented functions. Given a parent table / PK and a child table / FK, establish a relationship. Does anyone have that? John W. Colby Colby Consulting www.ColbyConsulting.com