0% found this document useful (0 votes)
28 views

DB Script

The document contains code to create and alter stored procedures and tables. It sets transaction isolation level, begins and commits transactions, and alters stored procedures to add output parameters and check user passwords. It also creates a stored procedure to retrieve employees with paging and sorting, and alters tables to change column data types.

Uploaded by

wajahat_abbas
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

DB Script

The document contains code to create and alter stored procedures and tables. It sets transaction isolation level, begins and commits transactions, and alters stored procedures to add output parameters and check user passwords. It also creates a stored procedure to retrieve employees with paging and sorting, and alters tables to change column data types.

Uploaded by

wajahat_abbas
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

set xact_abort on; go begin transaction; go set ANSI_NULLS on; go alter PROCEDURE Confirm_Password (@userid varchar(255) ,@password varchar(255)

,@result bit output) AS

if exists(select * from tblaccount where [username]=@userid and BINARY_CHECKSUM([password]) =BINARY_CHECKSUM( @password)) begin set @result=1 end else begin set @result=0 end go commit; go

---------------set xact_abort on; go begin transaction; go set ANSI_NULLS on; go create PROCEDURE spGetAllEmployee (

@startIndex @pageSize @sortBy @totalEmployees


) AS SET NOCOUNT ON DECLARE

int, int, nvarchar(30), int OUTPUT

@sqlStatement nvarchar(max), @upperBound int

IF @startIndex < 1 SET @startIndex = 1 IF @pageSize < 1 SET @pageSize = 1 SET @upperBound = @startIndex + @pageSize

Select @totalEmployees=Count(*) From tblclinic SET @sqlStatement = ' SELECT E.* FROM ( SELECT ROW_NUMBER() OVER(ORDER BY ' + @sortBy + ') AS rowNumber, * FROM tblclinic ) AS E WHERE rowNumber >= ' + CONVERT(varchar(9), @startIndex) + ' AND rowNumber < ' + CONVERT(varchar(9), @upperBound) exec (@sqlStatement) go commit; go

VideoDB

set xact_abort on; go begin transaction; go alter table groups alter column description varchar(500); go alter table Users_IPAddress alter column username varchar(50); go alter table Users_IPAddress alter column ipaddress varchar(25); go commit; go

You might also like