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 |
|
magmo
Aged Yak Warrior
558 Posts |
Posted - 2006-10-11 : 02:53:12
|
| HiI try to use this within a query...(ISNULL(dbo.tbl_ShoppingCart.Att) AND ISNULL(dbo.tbl_ShoppingCart.Company)) AS NoAdressBut this doesen't work at all, could someone tell me how I should do this instead?Regards |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-10-11 : 02:56:15
|
| [code](ISNULL(dbo.tbl_ShoppingCart.Att) AND ISNULL(dbo.tbl_ShoppingCart.Company)) AS NoAdress[/code]which part of the query did you used this in? if you want to use in the Select query then you dont require "AND", I guess you want to concancate the to string , then you "+" instead of And[code](ISNULL(dbo.tbl_ShoppingCart.Att) + ISNULL(dbo.tbl_ShoppingCart.Company)) AS NoAdress[/code]Chiraghttp://chirikworld.blogspot.com/ |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-11 : 02:58:06
|
| What are you trying to accomplish? The query above makes no sense.1) Concatenating? -> ISNULL(dbo.tbl_ShoppingCart.Att, '') + ISNULL(dbo.tbl_ShoppingCart.Company, '') AS NoAdress2) Filter out those records with no addresses? -> WHERE dbo.tbl_ShoppingCart.Att IS NULL AND dbo.tbl_ShoppingCart.Company IS NULLPeter LarssonHelsingborg, Sweden |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-11 : 02:58:46
|
Peter LarssonHelsingborg, Sweden |
 |
|
|
magmo
Aged Yak Warrior
558 Posts |
Posted - 2006-10-11 : 03:07:54
|
| HiI try to check 2 columns if they have null values and if so indicate this by setting the "NoAdress" column to 0. I dont want to filter out thoose rows that have null values, they have other information that I need to display but I need to check 2 columns for null values and indicate this in one column only.Hope this make sence.Regards |
 |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-10-11 : 03:10:10
|
| Somthing like this ?ISNULL(dbo.tbl_ShoppingCart.Att,'0') + ISNULL(dbo.tbl_ShoppingCart.Company,'0') AS NoAdressChiraghttp://chirikworld.blogspot.com/ |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-10-11 : 03:28:17
|
Rather SELECT CASE WHEN dbo.tbl_ShoppingCart.Att IS NULL AND dbo.tbl_ShoppingCart.Company IS NULL THEN 0 ELSE 1 END AS NoAddressFROM YourTable Peter LarssonHelsingborg, Sweden |
 |
|
|
magmo
Aged Yak Warrior
558 Posts |
Posted - 2006-10-11 : 03:31:59
|
| Hi PeterThat worked very well, Thank you so much!Best Regards |
 |
|
|
|
|
|
|
|