Re: Deletin db

From: Uri Dimant (urid_at_iscar.co.il)
Date: 07/06/04


Date: Tue, 6 Jul 2004 08:09:54 +0200

Hari
If a table is referenced by foreign key I think a delete command will also
return an error.

create table p
(
 col int primary key
)
insert into p values (1)
go
create table c
(
 col int primary key,
 col1 int references p (col)
)
insert into c values (1,1)
insert into c values (2,1)

go
truncate table p
go
delete table p

"Hari Prasad" <hari_prasad_k@hotmail.com> wrote in message
news:eAEvKXqYEHA.1000@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> It seems you have to delete the jobs table, not the entire database.
>
>
> 1. Login to Query analyzer
>
> 2. Select the database in which jobs table reside
>
> 3. Execute the below command to clear the table.
>
> TRUNCATE TABLE Jobs
>
> 4. The above command will return an error if jobs table have foreign key
> relation. in that case use DELETE Command
>
> DELETE from jobs
>
> Note:
>
> Dropping the database will clear all the objects and data inside the
> database.
>
> Thanks
> Hari
> MCDBA
>
>
>
>
>
>
> "eNerGiZer1010" <eNerGiZer1010@discussions.microsoft.com> wrote in message
> news:2AB6E7BA-12DA-4D5F-8F4E-E7A165A67BE1@microsoft.com...
> > G'day,
> >
> > What I want to do is delete all data found in jobs table
> > because I need to update it by running a script on a log
> > file.
> >
> > When i wrote the function it gave me a script error
> > the syntax in near '<'. Here's what i re-wrote:
> >
> > FROM Jobs alter_database < Jobs >
> > SET single_user WITH ROLLBACK immediate go
> > DROP DATABASE < Jobs >
> >
> > I also looked for the easier way which is by from
> > Enterprise manager .. Expland databases.. Select
> > database.. Right click
> > and Delete, but I can't find Expland databases in
> > Enterprise Manager.
> >
> > Can someone tell me where it is and tell why I'm not able
> > to delete everything from Jobs table?
> >
> >
> > Cheers!
> >
> >
> >
>
>



Relevant Pages

  • Re: SQL DB
    ... It seems you have to delete the jobs table, not the entire database. ... Execute the below command to clear the table. ... >>> The reason why I need to delete the existing db in sql ...
    (microsoft.public.sqlserver.mseq)
  • Re: SQL DB
    ... because I need to update it by running a script on a log ... DROP DATABASE < Jobs> ... >Command to remove database. ...
    (microsoft.public.sqlserver.mseq)
  • Re: Deletin db
    ... It seems you have to delete the jobs table, not the entire database. ... Execute the below command to clear the table. ... > When i wrote the function it gave me a script error ...
    (microsoft.public.sqlserver.programming)
  • Re: Deletin db
    ... Could not truncate table 'Jobs' because this table does not exist in database 'master'. ... Execute the below command to clear the table. ...
    (microsoft.public.sqlserver.programming)
  • [ANN] ruby queue : rq-2.3.1
    ... added 'stage' option to submit mode, which allows submission in a 'holding' state. ... an central nfs mounted priority work queue in a synchronized fashion. ... single node is running jobs from it, the system will continue to process jobs. ... the first argument to any rq command is the name of the queue. ...
    (comp.lang.ruby)