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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help needed in writing select case logic

Author  Topic 

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2011-04-06 : 06:16:15
Table 1 :

Key P_resp


Table 2 :

Key Pro_resp

So user provides the key. If the 6th position of key is 'B' then select Table1.P_resp value else select Table2.Pro_resp. How to write this using select case ? please help me in this

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-04-06 : 06:18:02
[code]
if substring (@key, 6, 1) = 'B'
select Table1.P_resp value from Table1
else
select Table2.Pro_resp from Table2
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2011-04-06 : 06:25:20
can u please provide full query. that would help a lot
Go to Top of Page

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2011-04-06 : 06:37:15
Hi friend thaks for the help. I just confused my self. Now I realised
Go to Top of Page
   

- Advertisement -