Thursday, March 22, 2012

Database Files

Hi,
I Inserted a new file in my database, and when I try to exclude it from my d
atabase sql says that the file is not empty ! The question is : Is there a w
ay to clean up the file so can be deleted ! What shoud i Do !
Thank'sDBCC Shrinkfile (<yourdbname>, EMPTYFILE)
Look it up in BOL for a complete description.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Doubt" <anonymous@.discussions.microsoft.com> wrote in message
news:4803DDD7-1B38-4D71-9016-CED5BFD66A65@.microsoft.com...
> Hi,
> I Inserted a new file in my database, and when I try to exclude it from my
database sql says that the file is not empty ! The question is : Is there a
way to clean up the file so can be deleted ! What shoud i Do !
> Thank's|||Hi-
You can use :-
USE MyDB
GO
DBCC SHRINKFILE (MyDataFile, 7)
GO
This example shrinks the size of a file named MyDataFile in the MyDB user
database to 7 MB.
Thanks
-Surajit
surajits@.nospam.yahoo.com
"Doubt" <anonymous@.discussions.microsoft.com> wrote in message
news:4803DDD7-1B38-4D71-9016-CED5BFD66A65@.microsoft.com...
> Hi,
> I Inserted a new file in my database, and when I try to exclude it from my
database sql says that the file is not empty ! The question is : Is there a
way to clean up the file so can be deleted ! What shoud i Do !
> Thank's|||Argh!...
I should have known better.
The real code snippit shoudl be:
Use <MyDatabaseName>
go
DBCC Shrinkfile (<MyFileName>, EMPTYFILE)
You can then use the ALTER DATABASE command to remove the file.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Geoff N. Hiten" <SRDBA@.Careerbuilder.com> wrote in message
news:ezg5X%23LTEHA.3548@.TK2MSFTNGP09.phx.gbl...
> DBCC Shrinkfile (<yourdbname>, EMPTYFILE)
> Look it up in BOL for a complete description.
> --
> Geoff N. Hiten
> Microsoft SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
> I support the Professional Association for SQL Server
> www.sqlpass.org
> "Doubt" <anonymous@.discussions.microsoft.com> wrote in message
> news:4803DDD7-1B38-4D71-9016-CED5BFD66A65@.microsoft.com...
my[vbcol=seagreen]
> database sql says that the file is not empty ! The question is : Is there
a
> way to clean up the file so can be deleted ! What shoud i Do !
>

No comments:

Post a Comment