use AdventureWorks declare @num int set @num = 3 declare @salespersonid int select @num if @num = 2 begin set @salespersonid = (select top 1 Sales.SalesPerson.SalesPersonID from Sales.SalesPerson) end else if @num = 4 begin select 'you suck' end else begin select 'nun of the above' endCase Statement
select FirstName, LastName, (case EmailPromotion when 1 then 'EmailPromo' when 2 then 'TextPromo' else 'Leave me alone' End) as promo from Person.Contact
No comments:
Post a Comment