0% found this document useful (0 votes)
41 views3 pages

(Base) : / Object: Storedprocedure (Dbo) - (SP - Insertarusuario) Script Date: 01/19/2015 21:57:10

The document contains the code for several stored procedures in SQL Server: 1) sp_InsertarUsuario inserts a new user into the Administrativo table and accepts parameters for user ID, password, and role. 2) sp_EliminarAlumno deletes a student record from the DatosAlumnos table based on a student code parameter. 3) sp_EditarAlumno updates student name and age fields in the DatosAlumnos table where the student code matches the parameter. 4) eliminar deletes a record from the alumno table where the code matches the parameter. 5) validar_usu selects user data from the administ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views3 pages

(Base) : / Object: Storedprocedure (Dbo) - (SP - Insertarusuario) Script Date: 01/19/2015 21:57:10

The document contains the code for several stored procedures in SQL Server: 1) sp_InsertarUsuario inserts a new user into the Administrativo table and accepts parameters for user ID, password, and role. 2) sp_EliminarAlumno deletes a student record from the DatosAlumnos table based on a student code parameter. 3) sp_EditarAlumno updates student name and age fields in the DatosAlumnos table where the student code matches the parameter. 4) eliminar deletes a record from the alumno table where the code matches the parameter. 5) validar_usu selects user data from the administ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

INSERTAR USUARIO

USE [base]
GO
/****** Object: StoredProcedure [dbo].[sp_InsertarUsuario]
Date: 01/19/2015 21:57:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_InsertarUsuario]
@usuario as nchar(6),
@password as nchar(10),
@rol as nchar(5)
AS
BEGIN
INSERT INTO
[BDAcademico].[dbo].[Administrativo]
([Usuario]
,[Password]
,[Rol])
VALUES
(
@usuario,
@password,
@rol
)
END

Script

ELIMINAR ALUMNO

USE [base]
GO
/****** Object: StoredProcedure [dbo].[sp_EliminarAlumno]
Date: 01/19/2015 21:59:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_EliminarAlumno]
@codigo as varchar(5)
AS
BEGIN
delete from DatosAlumnos where Codigo = @codigo
END

Script

EDITAR ALUMNO

USE [base]
GO
/****** Object: StoredProcedure [dbo].[sp_EditarAlumno]
Script Date:
01/19/2015 22:00:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_EditarAlumno]
@codigo as varchar(5),
@nombre as varchar(10),
@edad as int
AS
declare @nombre1 as varchar(10)
set @nombre1=RTRIM(@nombre)
UPDATE DatosAlumnos SET Nombres = @nombre1,Edades = @edad WHERE
Codigo=@codigo

ELIMINAR

USE [base]
GO
/****** Object: StoredProcedure [dbo].[eliminar]
01/19/2015 22:08:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[eliminar]
@codigo as varchar(10)
AS
BEGIN
SET NOCOUNT ON;
delete from alumno where codigo = @codigo
END

Script Date:

VALIDAR USUARIO

USE [base]
GO
/****** Object: StoredProcedure [dbo].[validar_usu]
Script Date:
01/19/2015 22:09:14 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[validar_usu]
@usuario as varchar(10),
@pass as varchar(10)
AS
BEGIN
SET NOCOUNT ON;
SELECT * from administrador where usuario=@usuario and password
=@pass
END

You might also like