Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String concat and views

Status
Not open for further replies.

outofservice

Technical User
Feb 20, 2002
33
GB
Version: SQL2k Standard Edition
No service pack applied.

Basically, I have a view (taken from two tables) which contains an 'address' column containing the concatenated values of 3 existing columns (number, street and area).

My problem is that when I display the view in Enterprise manager I cannot see the concatenation in effect and the 'address' column returns 'null' values. When I display the view in query analyzer I can see the correct concatenated 'address' values as eg, 1, High, st.

Does anybody know why this is?


Lauryn Bradley
SQL Server DBA
 
Your query analyse is set with (Connection properties)

SET CONCAT_NULL_YIELDS_NULL OFF



 
PS, this is the code I am using.

CREATE VIEW a_view AS
SELECT

aeven.eid,
aeven.num_1,
event.tycod,
event.sub_tycod,
aeven.dgroup,
(LTRIM (
event.eapt + SPACE(1) +
event.estnum + SPACE(1) +
event.efeanme + SPACE(1) +
event.efeatyp + SPACE(1) +
event.edirsuf
))AS Location
FROM aeven LEFT OUTER JOIN event
ON aeven.eid = event.eid Lauryn Bradley
SQL Server DBA
 
I have already set SET CONCAT_NULL_YIELDS_NULL OFF so that cant be the reason why. Lauryn Bradley
SQL Server DBA
 
try using isnull() for each field in the concat string
for example: ISNULL(event.eapt,'') + SPACE(1) +
ISNULL(event.estnum,'') + SPACE(1).......
 
Thanks! Thats solved my problem nicely! Lauryn Bradley
SQL Server DBA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top