getting the objects in dependancy order is pretty easy;
here is an example:
CREATE TABLE #MyObjectHierarchy
HID int identity(1,1) not null primary key,
TYPE int,OBJECTTYPE AS CASE
WHEN TYPE = 1 THEN 'FUNCTION'
WHEN TYPE = 4 THEN 'VIEW'
WHEN TYPE = 8 THEN 'TABLE'
WHEN TYPE = 16 THEN 'PROCEDURE'
WHEN TYPE =128 THEN 'RULE'
--our list of objects in dependency order
INSERT #MyObjectHierarchy (TYPE,ONAME,OOWNER,SEQ)
EXEC sp_msdependencies @intrans = 1
select * from #MyObjectHierarchy
i use that along with a script contribution i made to export all DDL schema into a table in TSQL; kind of handy for having a snapshot of the schema on a daily/weekly basis, makes it simple to compare and all that...
does the above help you at all?
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!