Jump to content

If..else In Sql Doubt


Recommended Posts

Posted

bhayyas..nenu testing side market lo vunna..

 

oka job req. lo ila vundi "Understanding of database concepts including: - tables and columns - basic use of SQL Developer or similar tools - fundamental SQL select statement use including where clauses and joins "

 

dani meaning...basic SQl knowledge vunte saripotundi ana?

 

nenu SQL eppudu use cheyaledu  sSc_hidingsofa 

Posted

bhayyas..nenu testing side market lo vunna..

 

oka job req. lo ila vundi "Understanding of database concepts including: - tables and columns - basic use of SQL Developer or similar tools - fundamental SQL select statement use including where clauses and joins "

 

dani meaning...basic SQl knowledge vunte saripotundi ana?

 

nenu SQL eppudu use cheyaledu  sSc_hidingsofa 

 

avunu basic t-sql selects and joins vastey chaalu ani.... basic ga avi vastey t-sql mottam vachinattey anukoo.... gsb12.gif

Posted

avunu basic t-sql selects and joins vastey chaalu ani.... basic ga avi vastey t-sql mottam vachinattey anukoo.... 

avi nerchukovadaniki easy gane vuntaya?

 

T-sql enti?

Posted

thanks baaa......chuste simple gane undi gaani,,,general ga mutlple conditions tho  rayalante ne.problem aitundi....

simple ee kada bhayya like all other prog langs

 

IF(CONDITION ) //condition true ayithey 

  BEGIN

      sql statments here

   END

ELSE //conditon false ayithey 

   BEGIN 

      sql statments here  

   END.

 

nested rayali ante ELSE lo malli inko IF vadali like below 

 

IF(CONDITION ) //condition true ayithey 

  BEGIN

      sql statments here

   END

ELSE //conditon false ayithey 

 BEGIN

    IF(CONDITION)

        BEGIN 

           sql statments here  

        END.

    ELSE

        BEGIN 

           sql statments here  

         END

  END

 

I am not sure if you are asking for something else. 

 

 

baaga amaykudu laaga unnav man...

 

lets say you have 3 customers... you want to update the data based on the input to your procedure.

 

CREATE PROC usp_updatedata

(@CountryName VARCHAR(10))

AS

BEGIN

 

IF(@CountryName = 'USA')

BEGIN

UPDATE Customer

SET ActiveFlag = 0

WHERE Country = @CountryName

END

ELSE

BEGIN

UPDATE Customer

SET ActiveFlag = 1

WHERE Country = @CountryName

END

 

END

 

If else statements are regularly used and can be used in procs and functions only since views can't handle logics...

 

Posted

avi nerchukovadaniki easy gane vuntaya?

 

T-sql enti?

 

Transact - SQL...

 

SQL antey Structured Query Language...

 

malli adi adugutaavemo ani mundey vesesaa man... gsb12.gif

×
×
  • Create New...