Click here to Skip to main content
15,562,414 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL bit to bool conversion Pin
Richard MacCutchan16-Aug-11 2:15
mveRichard MacCutchan16-Aug-11 2:15 
GeneralRe: SQL bit to bool conversion Pin
5fingers17-Aug-11 1:56
5fingers17-Aug-11 1:56 
GeneralRe: SQL bit to bool conversion Pin
Richard MacCutchan17-Aug-11 2:27
mveRichard MacCutchan17-Aug-11 2:27 
GeneralRe: SQL bit to bool conversion Pin
Smithers-Jones16-Aug-11 2:03
Smithers-Jones16-Aug-11 2:03 
GeneralRe: SQL bit to bool conversion Pin
5fingers17-Aug-11 1:56
5fingers17-Aug-11 1:56 
QuestionLocal Variable Ntext Probelm sql 2005 Pin
md_refay14-Aug-11 2:10
md_refay14-Aug-11 2:10 
Answercross-post Pin
Wendelius14-Aug-11 2:45
mveWendelius14-Aug-11 2:45 
QuestionCheck Different Select query result Pin
Naunt11-Aug-11 19:17
Naunt11-Aug-11 19:17 
Dear all,
Please suggest me to write shortest and effective query in Storeprocedure.
To assign value to @Color, there will be different select queries with different conditions, My query sample will be as the following,

SQL
Select @result=count(*) from table where condition1
IF @result = 20
    Begin
        @Color='Red Color'
    End
Else
    Begin
        select @result=count(*) from table where condition2
        IF @result=20
        Begin
            @Color='Blue Color'
        End
        Else
        Begin
            select @result=count(*) from table where condition3
            IF @result>0
            Begin
                @Color='Blue Color'
            End
            Else
            Begin
                Select  @result=count(*) from table where Condition4
                IF @result>0
                Begin
                    @Color='Blue Color'
                End
                Else
                Begin
                    Select @result=count(*) from where Condition5
                    IF @result=20
                    Begin
                        @Color='Green Color'
                    End
                    Else
                    Begin
                        Select @result=count(*) from where Condition6
                        IF @result>0
                        Begin
                            @Color='Yellow Color'
                        End
                        Else
                        Begin
                            @Color='Orange Color'
                        End
                    End
                End
            End
        End
    End




Thanks and best regards
AnswerRe: Check Different Select query result Pin
Mycroft Holmes11-Aug-11 20:59
professionalMycroft Holmes11-Aug-11 20:59 
GeneralRe: Check Different Select query result Pin
Naunt11-Aug-11 22:55
Naunt11-Aug-11 22:55 
GeneralRe: Check Different Select query result Pin
Mycroft Holmes11-Aug-11 23:54
professionalMycroft Holmes11-Aug-11 23:54 
GeneralRe: Check Different Select query result Pin
Wendelius12-Aug-11 0:17
mveWendelius12-Aug-11 0:17 
GeneralRe: Check Different Select query result Pin
Naunt12-Aug-11 1:46
Naunt12-Aug-11 1:46 
GeneralRe: Check Different Select query result Pin
Wendelius12-Aug-11 1:55
mveWendelius12-Aug-11 1:55 
GeneralRe: Check Different Select query result Pin
Naunt12-Aug-11 2:09
Naunt12-Aug-11 2:09 
GeneralRe: Check Different Select query result Pin
Wendelius12-Aug-11 3:38
mveWendelius12-Aug-11 3:38 
GeneralRe: Check Different Select query result Pin
Naunt12-Aug-11 1:50
Naunt12-Aug-11 1:50 
AnswerRe: Check Different Select query result Pin
Wendelius11-Aug-11 22:04
mveWendelius11-Aug-11 22:04 
GeneralRe: Check Different Select query result Pin
Naunt11-Aug-11 23:24
Naunt11-Aug-11 23:24 
AnswerRe: Check Different Select query result [modified] Pin
Wendelius12-Aug-11 0:04
mveWendelius12-Aug-11 0:04 
GeneralRe: Check Different Select query result Pin
Naunt12-Aug-11 1:56
Naunt12-Aug-11 1:56 
AnswerRe: Check Different Select query result Pin
Pascal Ganaye16-Aug-11 7:28
Pascal Ganaye16-Aug-11 7:28 
QuestionSee this Pin
sivakumat11-Aug-11 2:20
sivakumat11-Aug-11 2:20 
QuestionCompare 3columns from a row with data Null value Pin
Naunt11-Aug-11 0:16
Naunt11-Aug-11 0:16 
AnswerRe: Compare 3columns from a row with data Null value Pin
Mycroft Holmes11-Aug-11 0:26
professionalMycroft Holmes11-Aug-11 0:26 

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.