Wrox Programmer Forums
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 6th, 2007, 02:10 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

While a Database is comprised of many things, Tables are the main data element that admins deal with. In any case, rob answered your original post of:

first , Drop all constraint (primary Key & foreign key) then DELETE all
Record !

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old April 15th, 2007, 05:32 PM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

PERSIAN BOY present :

Hi freinds
my solution :

Create table #t(id bigint,lvl int)

insert into #t
Select distinct id,0 from sysobjects where id not in(
Select fkeyid From sysforeignkeys where fkeyid<>rkeyid)
and type='u'
Declare @l int
Set @L=0
While @L<1000
Begin
insert into #t
    Select distinct fkeyid,@L+1 from sysforeignkeys where rkeyid in(
    Select id From #T where lvl=@L) and fkeyid<>rkeyid
    if @@Rowcount=0 Set @L=1001
    Set @L=@L+1
End
Declare Cr1 Cursor local For
Select id From #T order by lvl desc
Declare @id bigint,@TName varchar(max)
Open Cr1
Fetch Next From cr1 into @Id
While @@Fetch_Status=0
Begin
    Select @Tname='Delete ['+(
        Select Name from sysusers where uid=sysobjects.uid)
        +'].['+name +']' From sysobjects where id=@id
    --exec( @TName)

    Fetch Next From cr1 into @Id
End
Drop table #T



WARNING :
for RUN (empty) out from comment --exec( @TName) .


:D





Similar Threads
Thread Thread Starter Forum Replies Last Post
Inner empty tag jdzsolt XSLT 2 August 8th, 2008 03:49 PM
Query was empty!!!!!!!!!!!!!!!!!!!!!!!!! gargamel BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 5 March 27th, 2007 11:32 AM
check if empty hosefo81 Javascript How-To 12 March 9th, 2004 08:43 AM
if search comes up empty abbylee26 Classic ASP Databases 3 October 4th, 2003 04:45 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.