LJG
asked on
View based on view with concatinated fileld returns a null value
Why does the below view based on vw_1 bring back a null value (Note: Vw_1 does not return null value on Prop_Name on any row) - SQL Server 2008
----------- Prop Name Returns Null Value --------------
SELECT Prop_Name, PropID FROM dbo.vw_1
GROUP BY Prop_Name, PropID
----------- Prop Name >>Does Not<< Returns Null Value --------------
SELECT Prop_Name FROM dbo.vw_1
GROUP BY Prop_Name
----------- Prop_Name --------------
dbo.tbl_Properties.PropNam
----------- Entire View #1 --------------
SELECT TOP (100) PERCENT dbo.tbl_Properties.PropNam
+ '000', 3) AS Prop_Name, dbo.tbl_Properties.PropID,
dbo.tbl_Prop_Agreements.Pr
FROM dbo.tbl_Prop_Agreements LEFT OUTER JOIN
dbo.tbl_Prop_Surfaces ON dbo.tbl_Prop_Agreements.Pr
dbo.tbl_Properties ON dbo.tbl_Prop_Surfaces.Prop
WHERE (dbo.tbl_Properties.PropID
Thanks in advance for any help.
LJG
Some sample data and the schemas of the tables would be useful
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Lowfatspread:
Thanks - you led me to the answer:
The problem was that .tbl_Properties.PropAddres s was null - that caused the concatenated field Prop_Name to be Null
----------- Prop_Name --------------
dbo.tbl_Properties.PropNam e + N': ' + dbo.tbl_Properties.PropAdd ress + N': zip-' + LEFT(ISNULL(dbo.tbl_Proper ties.PropZ ip, N'') + '000', 3) AS Prop_Name
Thanks
LJG
Thanks - you led me to the answer:
The problem was that .tbl_Properties.PropAddres
----------- Prop_Name --------------
dbo.tbl_Properties.PropNam
Thanks
LJG