Hi, PANDEY Prashant
This is the stored procedure I created based on your description to refresh the specific area with the current date.
CREATE PROCEDURE ProcessMonthlyPartition
AS
BEGIN
DECLARE @CurrentMonth NVARCHAR(20)
DECLARE @PartitionName NVARCHAR(100)
DECLARE @JsonCommand NVARCHAR(MAX)
DECLARE @CurrentYear NVARCHAR(4)
-- Get current month and year
SET @CurrentMonth = DATENAME(MONTH, GETDATE())
SET @CurrentYear = DATEPART(YEAR, GETDATE())
-- Build partition name
SET @PartitionName = 'Partition_' + @CurrentMonth + @CurrentYear
-- Build TMSL command
SET @JsonCommand =
'{
"refresh": {
"type": "automatic",
"objects": [
{
"database": "dev-ssas",
"table": "fact_viewing_session_member",
"partition": "' + @PartitionName + '"
}
]
}
}'
Regards
Mikey Qiao
If you're satisfied with the answer, don't forget to "Accept it," as this will help others who have similar questions to yours.