I'm trying to create a new db, specifying the FILENAME. This works great, except i need to do it through osql. When I do, SQL Server seems to ignore the FILENAME and creates the db in the default data folder.
Does anyone have any ideas?
Does anyone have any ideas?
Code:
SET @sSql = 'CREATE DATABASE ' +
+ @sDB_Namn + '
ON
(
NAME = ' + @sDB_Namn + ',
FILENAME=''' + @sPath + '\' + @sDbFileName + '''
)
LOG ON
(
NAME = ' + @sDB_Namn + '_Log,
FILENAME=''' + @sPath + '\' + @sLogFileName + '''
)'
PRINT @sSql
SET @sCommand = 'isql -U ' + @sPriviligedLogin + ' -P ' + @sPriviligedPassword + ' -Q "' + @sSql + '"'
EXEC master..xp_cmdshell @sCommand