Advertisement
movigos

Untitled

Feb 12th, 2024
602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.95 KB | None | 0 0
  1. create table dbo.UserToken
  2. (
  3.     Id          int identity
  4.         constraint UserToken_pk
  5.             primary key,
  6.     AccessToken nvarchar(max) not null,
  7.     UserId      int           not null
  8.         constraint UserToken_User_Id_fk
  9.             references dbo.[User],
  10.     Expiration  bigint        not null
  11. )
  12.  
  13. CREATE procedure UsersToken_Update @Id int,
  14.                                    @AccessToken nvarchar(255),
  15.                                    @Expiration datetime
  16. as
  17. begin
  18.     update dbo.[UserToken]
  19.     set AccessToken = @AccessToken,
  20.         Expiration  = @Expiration
  21.     where Id = @Id
  22. end;
  23.  
  24.     CREATE procedure UsersToken_Insert @AccessToken nvarchar(255),
  25.                                        @UserId int,
  26.                                        @Expiration datetime
  27.     AS
  28.     BEGIN
  29.         INSERT INTO dbo.[UserToken] (AccessToken, UserId, Expiration)
  30.         VALUES (@AccessToken, @UserId, @Expiration);
  31.     END;
  32.  
  33. go
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement