Click here to Skip to main content
15,891,316 members
Home / Discussions / Database
   

Database

 
QuestionDynamic sort Pin
vanikanc1-Aug-11 2:54
vanikanc1-Aug-11 2:54 
AnswerRe: Dynamic sort Pin
Herman<T>.Instance1-Aug-11 3:15
Herman<T>.Instance1-Aug-11 3:15 
GeneralRe: Dynamic sort Pin
vanikanc1-Aug-11 3:45
vanikanc1-Aug-11 3:45 
GeneralRe: Dynamic sort Pin
Corporal Agarn1-Aug-11 5:18
professionalCorporal Agarn1-Aug-11 5:18 
AnswerRe: Dynamic sort [modified] Pin
Shameel1-Aug-11 5:30
professionalShameel1-Aug-11 5:30 
GeneralRe: Dynamic sort Pin
vanikanc1-Aug-11 7:34
vanikanc1-Aug-11 7:34 
AnswerRe: Dynamic sort Pin
jschell1-Aug-11 8:34
jschell1-Aug-11 8:34 
QuestionStored Procedure to find emails Pin
Tiger45631-Jul-11 7:08
Tiger45631-Jul-11 7:08 
Priority ways email finding

I have following tables in project

Customer => Customer details
=> Coloums are Customer Name, Customer Type (Gold, Silver, Platinum)
Contact => Can have multiple contacts to a customer
=> Coloums are Customer Id, Name, email, Designation (D1 to D10).


we need to create an SP (MS SQL 2005 ) which returns priority 1 and priority 2 emails of customer (Customer Id will be passed as input) based on following criteria .

When Customer Type is "Gold" Customer, choose email based on following Designation
1. D1, D3,
2 D4, D6
3, D5, D7, D8
Logic :
a). if D1 exist select D1 and move to set 2, 
       D1 NOT exist select D3 and Move to set 2
                           D3 NOT exist move to set 2
b) if D4 exist select D4 and move to set 3, 
       D4 NOT exist select D6 and Move to set 3
                           D6 NOT exist move to set 3
    Note : if we got an email in first step and this step retun two emails. No need to iterate step 3
c)  reapeat above logic with step 3 designations sequentially

Continue searching until we get 2 mails. 


For "Silver" Customer choose email based on following designation
1. D1, D2,
2 D6, D7
3, D8, D9, D10
For "Platinum" Customer choose email based on following designation
1. D1, D2,
2 D8, D9
3, D3, D4, D10

I am not sure i explained logic very well. Is there any algorith for this type of logic.
AnswerRe: Stored Procedure to find emails [modified] Pin
Shameel31-Jul-11 7:20
professionalShameel31-Jul-11 7:20 
GeneralRe: Stored Procedure to find emails Pin
Tiger45631-Jul-11 7:41
Tiger45631-Jul-11 7:41 
GeneralRe: Stored Procedure to find emails Pin
Shameel31-Jul-11 7:47
professionalShameel31-Jul-11 7:47 
GeneralRe: Stored Procedure to find emails Pin
Anish Gopi2-Aug-11 2:02
sitebuilderAnish Gopi2-Aug-11 2:02 
GeneralRe: Stored Procedure to find emails Pin
Shameel2-Aug-11 8:45
professionalShameel2-Aug-11 8:45 
Question[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Pin
nazimghori31-Jul-11 1:14
nazimghori31-Jul-11 1:14 
AnswerRe: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Pin
thatraja31-Jul-11 6:03
professionalthatraja31-Jul-11 6:03 
AnswerRe: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Pin
Shameel31-Jul-11 7:23
professionalShameel31-Jul-11 7:23 
AnswerRe: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Pin
Monjurul Habib31-Jul-11 7:41
professionalMonjurul Habib31-Jul-11 7:41 
QuestionMaking the SSIS Data Reader Source Query Dynamic Pin
Member 808202128-Jul-11 14:44
Member 808202128-Jul-11 14:44 
AnswerRe: Making the SSIS Data Reader Source Query Dynamic Pin
S Douglas11-Aug-11 9:29
professionalS Douglas11-Aug-11 9:29 
GeneralRe: Making the SSIS Data Reader Source Query Dynamic Pin
Member 808202115-Oct-11 4:37
Member 808202115-Oct-11 4:37 
QuestionHow to get the 'GENERATED ALWAYS AS IDENTITY' attribute of the column from a DB2 table? Pin
coder21k27-Jul-11 20:17
coder21k27-Jul-11 20:17 
QuestionLast record in MYSQL Pin
pix_programmer27-Jul-11 18:45
pix_programmer27-Jul-11 18:45 
AnswerRe: Last record in MYSQL Pin
_Damian S_27-Jul-11 19:23
professional_Damian S_27-Jul-11 19:23 
AnswerRe: Last record in MYSQL Pin
thatraja28-Jul-11 15:26
professionalthatraja28-Jul-11 15:26 
QuestionFind Last Record In Sequence Pin
Adam Jasper26-Jul-11 0:45
Adam Jasper26-Jul-11 0:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.