Showing posts with label analyzer. Show all posts
Showing posts with label analyzer. Show all posts

Thursday, March 29, 2012

database name

When using query analyzer i need to know what database the scripts is
running on and store that name into a variable. is there a global database
name variable? I know about @.@.servername but no @.@.databasename :(DB_NAME()
David Portas
SQL Server MVP
--
"eg" <emil@.dbworks.com> wrote in message
news:u$CXluRnFHA.3960@.TK2MSFTNGP12.phx.gbl...
> When using query analyzer i need to know what database the scripts is
> running on and store that name into a variable. is there a global database
> name variable? I know about @.@.servername but no @.@.databasename :(
>|||select db_name()
"eg" wrote:

> When using query analyzer i need to know what database the scripts is
> running on and store that name into a variable. is there a global database
> name variable? I know about @.@.servername but no @.@.databasename :(
>
>|||ty
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:roqdnX7ixsVdlGTfRVn-1A@.giganews.com...
> DB_NAME()
> --
> David Portas
> SQL Server MVP
> --
> "eg" <emil@.dbworks.com> wrote in message
> news:u$CXluRnFHA.3960@.TK2MSFTNGP12.phx.gbl...
>

Friday, February 17, 2012

Database log size

hi

my database on remote server i cannot access directly.

i can access it only with query analyzer.

my log file size is 9mb but nothing in database. only few tables there so how i can reduce log file size with query.

thanks

Hi,

I used to do this using the sa privileges.

Google it for (Truncating SQL Log)

Let me know if you need further help.

Regards

|||

Change the recovery model to simple. Set autoshrink to true, back up the database and it should reduce in size.

|||

I don't want you to waste your time, here is the query,

BACKUP LOG databasename WITH TRUNCATE_ONLY
DBCC SHRINKFILE ('databaselog_log', 100) WITH NO_INFOMSGS

It will shrink the log to 100 MB

|||

thanks dear

my problem solved with following

BACKUP LOG databasename WITH TRUNCATE_ONLY
DBCC SHRINKFILE ('databaselog_log', 2) WITH NO_INFOMSGS


DBCC SHRINKFILE(mydatabase)