Good Morning,
I have a good look around for the answer but cant find it. Either that or the answer was there but I am thinking of it differently.
Basically, I have a large number of columns that I want to update from a select statement.
Looks something like this
DECLARE @StartDate as DATETIME;
DECLARE @EndDate as DATETIME;
DECLARE @Branches as VARCHAR(50);
DECLARE @Partcodelist VARCHAR(8000);
SELECT @StartDate = (SELECT MIN(Date) FROM calendar WHERE WeekID = (SELECT WeekID FROM calendar WHERE Date = udf_CalculateDateShift(-56))),
@EndDate = udf_CalculateDateShift(-1),
@Branches = '2000,2001,
@Partcodelist = 'part1, part2';
UPDATE dbo.Table T
SET a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p
FROM (select a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p from lots of other select sub queries) x
where t.date = x.date and t.branch = x.branch
Is that possible or do i have to do it some other way?
Thanks
Dave.