partitioning - Programmatically name FILEGROUP in SQL server? -
I am trying to write a stored procedure which will create a new FILEGROUP based on a set date parameter. What I see is a 'FILEGROUP' which is called something like '2010_02_01' What I get is 'PartitionName' called 'FILEGROUP'
Optional Process (DBO). [SP_CREATE_DATE_FILEGROUP] @ DECLARE @ PartitionName as a Participation Date VARCHAR (10); BEGIN SET @partitionName = REPLACE (left (convert (VARCHAR, partition date, 120), 10), '-', '_'); Change Database MSP Location Location FIREGROUP [@PartitionName]; END
You're about to end using it to use sp_executesql Announce something like
@ sql nvarchar (4000) setl @sql = 'ALTER DATABASE MSPLocation ADD FILEGROUP [' + @ PartitionName + ']' exec sp_executesql @sql
< / Pre>
Comments
Post a Comment