Download SQL-Joins-and-Views PDF

TitleSQL-Joins-and-Views
TagsSql Table (Database) Computer Data Data Management Software
File Size351.2 KB
Total Pages18
Document Text Contents
Page 17

SELECT * FROM Per sons WHERE
Last Name=' Svendson'
AND ( Fi r st Name=' Tove' OR Fi r st Name=' Ol a' )

The result-set will look like this:

P_Id LastName FirstName Address City

2 Svendson Tove Borgvn 23 Sandnes

Sample SP

CREATE PROC my_Check
(
@SerialNumber NVARCHAR(50) =NULL,
@ReturnParameter INT OUTPUT
)
AS

IF EXISTS (
SELECT * FROM Schedule WHERE [email protected] AND Start IS NOT
NULL
)
BEGIN
SELECT @ReturnParameter='1'
END
ELSE IF EXISTS (
SELECT * FROM Schedule WHERE [email protected] AND Start IS NOT
NULL
)
BEGIN
SELECT @ReturnParameter='2'
END
ELSE
BEGIN
SELECT @ReturnParameter=NULL
END

PRINT @ReturnParameter

Similer Documents