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 |
|
gamaz
Posting Yak Master
104 Posts |
Posted - 2010-05-04 : 14:47:32
|
| Hi,I have the following code in sqlDECLARE @slsman NVARCHAR(8), @cust_name NVARCHAR(60), @customer_rowpointer UNIQUEIDENTIFIER SELECT @slsman = null, @cust_name = null, @customer_rowpointer = null SELECT TOP 1 @slsman = customer.slsman ,@customer_rowpointer = customer.rowpointer from customerNow I need to change the above code such that if slsman field is blank in customer then it should look for the field from a differnt table in the database named sales and table saleman_detail.I have to incorporate this logic in the above code. I am not sure how to do this. I appreciate any help.Thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-05-04 : 14:49:32
|
| IF @slsman = ''SELECT @slsman=yourrequiredfieldFROM sales..saleman_detail------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
gamaz
Posting Yak Master
104 Posts |
Posted - 2010-05-05 : 09:46:14
|
| Thanks vishkh for your help. I appreciate it. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-05-05 : 14:46:15
|
| welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|