Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE ConversatieInsertion
- AS
- BEGIN
- SET NOCOUNT ON;
- declare @nume VARCHAR(50);
- declare @id INT;
- SET @id = (SELECT TOP 1 MAX(Conversatie.Cid) FROM Conversatie);
- SET @nume = CONCAT('Conversatia', (SELECT CAST(@id as varchar(50))));
- if @id is NULL
- set @id = 0;
- INSERT INTO Conversatie(Cid, NumeConversatie)
- VALUES(@id+1, @nume);
- END
- ALTER PROCEDURE ChatInsertion
- AS
- BEGIN
- SET NOCOUNT ON;
- declare @Cid int;
- declare @Uid int;
- declare @NumarMesaje int;
- SET @Cid = (SELECT TOP 1 MAX(dbo.Conversatie.Cid) FROM
- Conversatie);
- SET @Uid = (SELECT TOP 1 MAX (dbo.Utilizator.Uid) FROM
- Utilizator);
- SET @NumarMesaje = (SELECT RAND()*100);
- INSERT INTO Chat(Cid, Uid, NumarMesaje) VALUES
- (@Cid+1, @Uid+1, @NumarMesaje);
- END
- ALTER PROCEDURE PozaInsertion
- AS
- BEGIN
- SET NOCOUNT ON;
- declare @pid INT;
- SET @pid = (SELECT TOP 1 MAX(Poza.Pid) FROM Poza);
- declare @dataPoza DATE;
- SET @dataPoza = '2019-10-10';
- declare @NumarLike INT;
- declare @NumarLove INT;
- declare @NumarAngry INT;
- declare @NumarHaha INT;
- declare @NumarSad INT;
- declare @Uid INT;
- SET @NumarLike= (SELECT RAND()*100);
- SET @NumarLove= (SELECT RAND()*100);
- SET @NumarAngry= (SELECT RAND()*100);
- SET @NumarHaha= (SELECT RAND()*100);
- SET @NumarSad= (SELECT RAND()*100);
- SET @Uid = (SELECT TOP 1 MAX (dbo.Utilizator.Uid) FROM
- Utilizator);
- INSERT INTO Poza(Pid, DataPoza, NumarLike, NumarLove,
- NumarAngry, NumarHaha, NumarSad, Uid) VALUES
- (@pid, @dataPoza, @NumarLike, @NumarLove, @NumarAngry,
- @NumarHaha, @NumarSad, @Uid);
- END
- CREATE PROCEDURE ConversatieDelete
- AS
- BEGIN
- SET NOCOUNT ON;
- DELETE from Conversatie;
- END
- CREATE PROCEDURE ChatDelete
- AS
- BEGIN
- SET NOCOUNT ON;
- EXEC ConversatieDelete;
- Delete from Utilizator;
- Delete from Chat;
- END
- CREATE PROCEDURE PozaDelete
- AS
- BEGIN
- SET NOCOUNT ON;
- Delete from Utilizator;
- Delete from Poza;
- END
- select * from Tables
- select * from TestTables
- select * from Tests
- select * from Views
- DROP PROCEDURE ConversatieInsertion
- DROP PROCEDURE ChatInsertion
- DROP PROCEDURE PozaInsertion
- DROP PROCEDURE ConversatieDelete
- DROP PROCEDURE ChatDelete
- DROP PROCEDURE PozaDelete
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement