Reply to Regarding table Order

Your name:

Reply:


Posted by pankaj_wolfhunter on 12/16/05 07:34

Greetings,
I have an application that need to get all the user
defined child tables first before their parents.
I wrote a query, given in this newsgroup only, as below

SELECT o.name
FROM sysobjects o
WHERE o.type='U'
ORDER BY case WHEN exists ( SELECT *
FROM sysforeignkeys f
WHERE o.id = f.fkeyid )
THEN 1
ELSE 0
end, o.name
go

When i try to truncate the first table of the list, it still tells me
that tha table is being referenced by foreign key in another table. My
main job is to truncate all the user defined tables before loading data
into them.
Is there something wrong in the query? Or if someone can tell me a
better approach.

Any help will be appreciated.

TIA

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация