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 |
|
CLages
Posting Yak Master
116 Posts |
Posted - 2004-01-17 : 10:59:36
|
| I have a main table with some columns and their relationship everything works fine.But i have one column that i need to make a relationship with other table,but this columns can be ZEROS or NULL , in this case realationship fails.the question is: how can i make a relationship only if the column is different from NULL or ZEROS?tksCarlos LagesRio de Janeiro |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-01-17 : 11:04:44
|
| join tbl t2on t1.col = t2.coland t2.col <> 0null will already be catered for as it will never be included in the join.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
CLages
Posting Yak Master
116 Posts |
Posted - 2004-01-17 : 16:28:42
|
| I am talking about relationship using MS-DIAGRAM.how to make a relationship in Diagram if one column is NULL?Diagram only make this if all keys is true.tksCarlos Lages |
 |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2004-01-18 : 19:17:45
|
| MS-DIAGRAM? Is that the name of the diagram builder in SQL Server Enterprise Manager? So what you're looking to create is a Foreign Key Constraint? Then every non-Null value in the primary table has to match a value in the foreign table. If there are NULLs in the primary table, then there is nothing for it to check in the destination, and that should be just fine when you create the constraint. As for Zeroes, you'll need a zero key in the foreign table or it will fail.--------------------------------------------------------------Find more words of wisdom at [url]http://weblogs.sqlteam.com/markc[/url] |
 |
|
|
|
|
|