Print ''
Print '-------------------------------------------------------------------------'
Print ' Script Creation Date : 22.02.2016'
Print ' Script Autor         : J.Feuerstein'
Print '-------------------------------------------------------------------------'
Print ' Create/Update Database'
Print ' DB Name :[#DB_N#]'
Print ' DB file :#DB_mdf_DPNE#'
Print ' Log file:#DB_ldf_DPNE#'
Print '-------------------------------------------------------------------------'

declare @MSSQLVersionInt integer
-- declare @ExecuteMsgRf    varchar(max)
set @MSSQLVersionInt=@@microsoftversion / power(2, 24)

declare @productversion nvarchar(128)
declare @productlevel nvarchar(128)
declare @edition nvarchar(128)

SELECT
    @productversion = CONVERT(VARCHAR(15),SERVERPROPERTY('productversion')),
    @productlevel   = CONVERT(VARCHAR(15),SERVERPROPERTY('productlevel')),
    @edition        = CONVERT(VARCHAR(15),SERVERPROPERTY('edition'))

Print 'Info:'
Print ' Check if DB.Exist: #DB_N#'

Print ' Servername.......: ' + CONVERT(VARCHAR(max),@@servername)
Print ' Version..........: ' + CONVERT(VARCHAR(55),@@version)
Print ' Edition..........: ' + @edition
Print ' MSSQLVersionInt..: ' + CONVERT(VARCHAR(15),@MSSQLVersionInt)

-- Datenbank Namen Verzeichniss und Files festlegen
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'#DB_N#')
   BEGIN
Print ' DB exist ........: YES'
   END
   ELSE
   BEGIN
Print ' DB exist ........: NO'
   END
GO
