Just can't see what I'm doing wrong. Any Ideas?
SELECT Address1, Address2, Suburb FROM i2b_address
IsNull (NullIf (Address1 + '', ''), '') +
IsNull (NullIf('','' + Address2,''),'') +
IsNull (NullIf('', '' + Suburb, ''), '') AS PropertyAddress
Server: Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'NullIf'.
Thanks for your help & efforts!
MartinSELECT Address1, Address2, Suburb,
IsNull (NullIf (Address1 + '', ''), '') +
IsNull (NullIf('','' + Address2,''),'') +
IsNull (NullIf('', '' + Suburb, ''), '') AS PropertyAddress
-- -> from clause goes here
FROM I2B_ADDRESS|||Hi! Well, something we don't notice the obvious! Thanks very much! I
think I need a break!
But still getting an error... Argh!!! What's wrong?
SELECT Address1, Address2, Suburb,
IsNull (NullIf (Address1 + '', ''), '') +
IsNull (NullIf('','' + Address2,''),'') +
IsNull (NullIf('', '' + Suburb, ''), '') AS PropertyAddress
FROM i2b_address
Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near ','.
Thanks for your help & efforts!
M|||Solved It!
IsNull (NullIf (Address1 + '', ''), '') +
IsNull (NullIf (', ' + Address2, ''), '') +
IsNull (NullIf (', ' + Suburb, ''), '') AS PropertyAddress|||If you use the Northwind database, Customers table, you'll see that
this also works...
I don't have your data structures and therefore need to use something I
do have...
SELECT ContactName, ContactTitle, Fax,
IsNull(NullIf (ContactName + ' ', ''), ' ') +
IsNull(NullIf(ContactTitle + ' ', ''), ' ') +
IsNull(NullIf(Fax + ' ', ''), ' ') AS PropertyAddress
FROM Customers
No comments:
Post a Comment