I am trying to automate a DB creation script where I receive the following table as an input:
INSERT INTO @FilePath (Directory,Type,NumberOfFiles)
VALUES ('E:\','DATA','2'),
('G:\','DATA','2'),
('F:\','LOG','1')
Where Directory is the directory where the files should be created
Type is the type of file to be created
NumberOfFiles is the number of files to be created.
For example the script should return for ('E:','DATA','2') two rows in the dynamic script:
( NAME = N''' + @DB_NAME + @FILE_NUMBER +', FILENAME = N'''+ @DataPath + @DB_NAME + '_Data\' + @DB_NAME + @FILE_NUMBER + ' , SIZE = 2097152KB , MAXSIZE = UNLIMITED, FILEGROWTH = 512000KB ),
( NAME = N''' + @DB_NAME + @FILE_NUMBER +', FILENAME = N'''+ @DataPath + @DB_NAME + '_Data\' + @DB_NAME + @FILE_NUMBER +' , SIZE = 2097152KB , MAXSIZE = UNLIMITED, FILEGROWTH = 512000KB )