Database Name "Alias"?


good day,

 

our sql server 2005 installation has active database periodically gets rolled on empty database new name. software inserts , updates database aware of name of active database. query users use shell database static name, and it has views active database. works fine.

 

our question regarding backup. there way establish databse name "alias", backup routines can remain unchanged point active database?

 

thanks in advance...

 

you can write script this. write function fetch currenct database , write dynamic sql take backup

 

something this

 

declare @dbname varchar(100)

select @dbname='testdb'--fncurrentdatabase()

declare @sqlstmt varchar(4000)

declare @backuppath varchar(20)

set @backuppath='c:\backup.bak'

set @sqlstmt='backup database '+@dbname+' disk='''+@backuppath +''' '

exec (@sqlstmt)

 

madhu

 



SQL Server  >  SQL Server High Availability and Disaster Recovery



Comments

Popular posts from this blog

Motherboard replacement

Cannot create Full Text Search catalog after upgrading to V12 - Database is not fully started up or it is not in an ONLINE state

Remote Desktop App - Error 0x207 or 0x607