>we create after installation of our application, if USE HM fails, with the following t-sql statement a database:
>
>create database HMThere's another way to check if database exists
IF db_id('DataBaseName') IS NOT NULL
PRINT 'DataBaseName' + ' exists!'
>We don't want give the File option FILENAME='c:\...', because we don't want to set absolute paths on SQL-Server machine (rights, ...).
>
>We need commands for
>
>- setting maxsize of transaction log from a unlimited size to a limited size
>
>?ALTER DATABASE HM MODIFY FILE (NAME = N'HM_log ', MAXSIZE = 10)
>
>- reducing (or deleting) size of transaction log, because maxsize can't
> be reduced to a mb size lower than the actual size.You can get default directories from the registry as follow
Declare @defaultdata nvarchar(2000)
declare @defaultlog nvarchar(2000)
exec master.dbo.xp_instance_regread
N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'DefaultData', @defaultdata output
print @defaultdata
exec master.dbo.xp_instance_regread
N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\MSSQLServer',N'DefaultLog', @defaultlog output
print @defaultlog
>What is a recommended size for transaction log ?There isn't one because it depends on many factors: DB recovey mode, # of transactions, backup strategy, e.t.c
--sb--