I would like to use parameters for the creation of databases based upon server name. I am upto the point where I am using @@SERVERNAME to determine which server the install is on. I would like to have variables for the paths. I am a little uncertain how best to do this. I suspect that using just + to concatenate would not be best or possibly correct.
Any help in doing this would be gratefully received.
DECLARE @DataPath nvarchar(255), @LogPath nvarchar(255)
SET @DataPath = '$(DataPath)' --'E:\Databases\'
SET @LogPath = '$(LogPath)' --'F:\Logs\'
CREATE DATABASE [PASTIS] ON PRIMARY
( NAME = N'PASTIS', FILENAME = N'D:\SQL_Data\MSSQL10.MSSQLSERVER\MSSQL\DATA\HASTATI.mdf' , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
( NAME = N'PASTIS_log', FILENAME = N'D:\SQL_Data\MSSQL10.MSSQLSERVER\MSSQL\DATA\HASTATI_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)