CASE statements

CASE statements

Post by Tek Bo » Tue, 25 Jan 2000 04:00:00



I'm trying to call a stored procedure within another stored procedure, based
on the value of a certain parameter.  Here's a snippet of the problematic
code:

************************************************





END
************************************************

I'm using SQL Server 7.0, and I'm getting the following errors:

        Error 156: Incorrect syntax near the keyword 'CASE'
        Incorrect syntax near the keyword 'THEN'

Any ideas?  TIA.......

-=Tek Boy=-

 
 
 

CASE statements

Post by BPMargoli » Tue, 25 Jan 2000 04:00:00


Try:



> I'm trying to call a stored procedure within another stored procedure,
based
> on the value of a certain parameter.  Here's a snippet of the problematic
> code:

> ************************************************





> END
> ************************************************

> I'm using SQL Server 7.0, and I'm getting the following errors:

>         Error 156: Incorrect syntax near the keyword 'CASE'
>         Incorrect syntax near the keyword 'THEN'

> Any ideas?  TIA.......

> -=Tek Boy=-


 
 
 

CASE statements

Post by Tek Bo » Tue, 25 Jan 2000 04:00:00


Sounds good.... =)  But just for the sake of learning what I was doing
wrong, is there a way to do it natively (without constructing a SQL string)?
Thanks again!

-=Tek Boy=-


> Try:




> > I'm trying to call a stored procedure within another stored procedure,
> based
> > on the value of a certain parameter.  Here's a snippet of the
problematic
> > code:

> > ************************************************





> > END
> > ************************************************

> > I'm using SQL Server 7.0, and I'm getting the following errors:

> >         Error 156: Incorrect syntax near the keyword 'CASE'
> >         Incorrect syntax near the keyword 'THEN'

> > Any ideas?  TIA.......

> > -=Tek Boy=-

 
 
 

CASE statements

Post by BPMargoli » Wed, 26 Jan 2000 04:00:00



   exec sClientListByFName

   exec sClientListByLName

   exec sClientListByCompany

   exec sClientListByUsername


> Sounds good.... =)  But just for the sake of learning what I was doing
> wrong, is there a way to do it natively (without constructing a SQL
string)?
> Thanks again!

> -=Tek Boy=-



> > Try:




> > > I'm trying to call a stored procedure within another stored procedure,
> > based
> > > on the value of a certain parameter.  Here's a snippet of the
> problematic
> > > code:

> > > ************************************************





> > > END
> > > ************************************************

> > > I'm using SQL Server 7.0, and I'm getting the following errors:

> > >         Error 156: Incorrect syntax near the keyword 'CASE'
> > >         Incorrect syntax near the keyword 'THEN'

> > > Any ideas?  TIA.......

> > > -=Tek Boy=-

 
 
 

1. Case Statement Dependent On Another Case Statement Possible?

I'm selecting data from my database for an export. While I know how to do
this on VB, I am wondering if I can do it in TSQL.
My statement would be like this, if it is possible.
Select Case Country
    When 'USA' Then 'United States'
        Case State
            When 'California' Then 'West Coast'
            When 'Virginia' Then 'East Coast'
            Else Null
            End,
    When 'CA' Then 'Canada'
        Case State
            When 'BC' Then 'West Coast'
            When 'Quebec' Then  'East Coast'
            Else Null
            End,
    Else Null
    End
From Locations Where....

The above is example data as it makes a littlle more sense than the codes I
have to put in place for the fields I am actually pulling.
Is somthing like this possible to do in TSQL?
Would a Begin...End clause aorund it help?

Thanks,
Chris

2. MSCD HELP???

3. Problem with Procedure(Case Statement IF ELSE Statement )

4. Record merging - cascade update problem

5. Case Statement in Update Statement

6. 9323-FL-South-ORACLE-DBA Skills-Database Administrator

7. Update statement with correlated subquery inside case statement fails

8. Other than cursors

9. Running an EXEC statement in a case statement

10. Switch Statement / Case Statement ?

11. Case Statement

12. How can I write this CASE statement?

13. Text field within case statement