Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

SQL Server:utilizzare il parametro in CREATE DATABASE

Dovrai usare SQL dinamico

SELECT @sql = 'CREATE DATABASE TestDB ON PRIMARY ( NAME = ''TestDB_Data'', 
 FILENAME = ' + quotename(@DataFilePath) + ') LOG ON ( NAME = ''TestDB_Log'', 
FILENAME = ' + quotename(@LogFilePath) + ')'

EXEC (@sql)