Feeds:
Posts
Comments

Archive for April, 2011

DECLARE @AllDays TABLE(Day_Date Datetime,Day_Level INT,Day_Name VARCHAR(30),Day_Diff INT)

DECLARE @StartDate datetime,@EndDate datetime

SET @StartDate=’01-Dec-2012′

SET @EndDate=’31-Dec-2012′

INSERT INTO @AllDays (Day_Date,Day_Level,Day_Name,Day_Diff) Values (@StartDate,1,DATENAME(weekday,@StartDate),ABS(DATEDIFF(day,@StartDate,@StartDate)))

WHILE (SELECT Max(Day_Date) FROM @AllDays) < @EndDate-1

BEGIN

WHILE (DATENAME(weekday,(SELECT Max(Day_Date) FROM @AllDays))) <> ‘Friday’

BEGIN

INSERT INTO @AllDays (Day_Date,Day_Level,Day_Name,Day_Diff) Values ((SELECT Max(Day_Date) FROM @AllDays)+1,1,DATENAME(weekday,(SELECT Max(Day_Date) FROM @AllDays)+1),ABS(DATEDIFF(day,(SELECT Max(Day_Date) FROM @AllDays)+1,(SELECT Max(Day_Date) FROM @AllDays)+1)))

END

INSERT INTO @AllDays (Day_Date,Day_Level,Day_Name,Day_Diff) Values

((SELECT Max(Day_Date) FROM @AllDays)+7,2,DATENAME(weekday,(SELECT Max(Day_Date) FROM @AllDays)),ABS(DATEDIFF(day,@StartDate,(SELECT Max(Day_Date) FROM @AllDays)+7)))

/*

IF (DATENAME(weekday,(SELECT Max(Day_Date) FROM @AllDays))) = ‘Friday’ And DAY((SELECT Max(Day_Date) FROM @AllDays))= 13

BREAK

ELSE

CONTINUE

*/

END

Select Max(Day_Date) FROM @AllDays

Read Full Post »

1.  we delete the column in publisher database table that deleted column will delete in subscriber database table .

2.  we add the new column in publisher database table then that newly added column will add to the  subscriber database table with below criteria .

In Publication Properties –> Subscription Options –> Replicate schema changes value is True then newly column will add to the subscription database table False then No Change.

Read Full Post »