Re: Deletin db
From: Uri Dimant (urid_at_iscar.co.il)
Date: 07/06/04
- Next message: Uri Dimant: "Re: Creating System SPROC"
- Previous message: Dan Guzman: "Re: using sql to update a table"
- In reply to: Hari Prasad: "Re: Deletin db"
- Messages sorted by: [ date ] [ thread ]
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!
> >
> >
> >
>
>
- Next message: Uri Dimant: "Re: Creating System SPROC"
- Previous message: Dan Guzman: "Re: using sql to update a table"
- In reply to: Hari Prasad: "Re: Deletin db"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|