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 |
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2009-05-28 : 04:09:47
|
| i need to take select query from my table assume TableA,in that other columns including customer_code but i dont have customer name.2)the use can give either of the input value or even none3)iam having customer master table in which customer code and name is maintainedmy sample procedure is:CREATE procedure invoice_adjustment_sp_new( @From_cust_code varchar(30), @To_Cust_code varchar(30), @From_cust_name varchar(50), @To_cust_name varchar(50))BEGINset nocount onselect * from Table Awhere ?set nocount offEND |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-28 : 04:11:51
|
just a simple INNER JOIN to the Customer Master table will do the job KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2009-05-28 : 04:51:17
|
quote: Originally posted by khtan just a simple INNER JOIN to the Customer Master table will do the job KH[spoiler]Time is always against us[/spoiler]
select A.*,B.customer_namefrom TableA as A with (nolock) and customer_master B(nolock)on a.cust_code=b.cust_codewhere a.cust_code between @from_cus and @to_custom |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-05-28 : 05:50:17
|
[code]select A.*,B.customer_namefrom TableA as A with (nolock) and INNER JOIN customer_master B(nolock)on a.cust_code=b.cust_codewhere a.cust_code between @from_cus and @to_custom[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|