I have two temp tables in a stored procedure.Both have a date field.
suppose #temp01 has 1000 company records and #temp03 has 100 company records. The 100 companies in #temp03 are already included in #temp01. I need an updat estatement where I need the date field from #temp03 to over write the date field in #temp01 for Just those 100 companies.
UPDATE #Temp01
SET vchCompanyDate = (select #temp03.dtInsertDate from #temp03 where #temp03.CompanyId=#temp01.iCompanyId)
I tried this and it doesnt work. It updates the 100 companies but also replaces the other 900 companies in temp01 with NULL.
(if or a case statement i guess..)
[highlight]
M.Bajwa
[/highlight]
suppose #temp01 has 1000 company records and #temp03 has 100 company records. The 100 companies in #temp03 are already included in #temp01. I need an updat estatement where I need the date field from #temp03 to over write the date field in #temp01 for Just those 100 companies.
UPDATE #Temp01
SET vchCompanyDate = (select #temp03.dtInsertDate from #temp03 where #temp03.CompanyId=#temp01.iCompanyId)
I tried this and it doesnt work. It updates the 100 companies but also replaces the other 900 companies in temp01 with NULL.
(if or a case statement i guess..)
[highlight]
M.Bajwa
[/highlight]