Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
abcefg
Starting Member
16 Posts |
Posted - 2009-03-16 : 02:30:12
|
How tp rewrite this query. for improvement....Inser into DIMDisBandSELECT distinct ''as[DIMDisBendNativeId] ,BDHW.dbo.DIMDis.DIMDisId AS fk_DIMDisId ,BLIVE.dbo.DisBand.LLimit ,BLIVE.dbo.DisBand.ULimit ,BLIVE.dbo.DisCode.CName ,BLIVE.dbo.DisBand.PDisValue ,BLIVE.dbo.DisBand.ValueDisVal ,BLIVE.dbo.DisBand.Updated_On AS LastModified ,1 AS fkdimcountryid FROM BLIVE.dbo.DisBand INNER JOIN BLIVE.dbo.DisCode ON BLIVE.dbo.DisBand.fkDiscountId = BLIVE.dbo.DisCode.DiscountId INNER JOIN BDHW.dbo.DIMDis ON BLIVE.dbo.DisCode.DiscountId = BDHW.dbo.DIMDis.DIMDisNativeId where BDHW.dbo.DIMDis.DIMDisId in (select fk_DIMDisId from BDHW.dbo.DIMDisBand) and cast(BDHW.dbo.DIMDis.DIMDisId as varchar(50)) + cast(BLIVE.dbo.DisBand.LLimit as varchar(50)) + cast(BLIVE.dbo.DisBand.ULimit as varchar(50)) + cast(BLIVE.dbo.DisCode.CName as varchar(50)) + cast (BLIVE.dbo.DisBand.PDisValue as varchar(50)) + cast (BLIVE.dbo.DisBand.ValueDisVal as varchar(50)) not in (select cast(fk_DIMDisId as varchar(50)) + cast(LLimit as varchar(50)) + cast(ULimit as varchar(50)) + cast(BandName as varchar(50)) + cast (PDisValue as varchar(50)) + cast (ValueDisVal as varchar(50)) from BDHW.dbo.DIMDisBand ) |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|