Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

ALTER DATABASE / ADD FILE / VARIABLE FILENAME?


Usando SQL dinâmico:
Declare @Path nvarchar(max)
Declare @Sql nvarchar(max)

Set @Path = 'C:\whatEverIWantItToBe\ThisCouldChangeWithLogic\YouGetThePoint\'

Set @Sql = 'Alter Database [MyDb]
    Add File( Name = ''MyDb_FileStream''
            , FileName = ' + QuoteName( @Path, '''' ) 
            + ') To FileGroup [MyDbFileStream]'

Exec( @Sql )