Guest User

Untitled

a guest
Jul 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. CREATE View vw_user_profile
  2. AS
  3. Select A.user_id, B.profile_description
  4. FROM tbl_user A left join tbl_profile B on A.user_id = b.user_id
  5. GO
  6.  
  7. SELECT profile_description FROM vw_user_profile WHERE user_id = @ID
  8.  
  9. create procedure dbo.getDesc
  10. @ID int
  11. AS
  12. begin
  13. SELECT profile_description FROM vw_user_profile WHERE user_id = @ID
  14. END
  15. GO
  16.  
  17. dbo.getDesc 25
  18.  
  19. CREATE View vw_user_profile AS
  20. Select A.user_id, B.profile_description
  21. FROM tbl_user A left join tbl_profile B on A.user_id = b.user_id
  22.  
  23. Update vw_user_profile Set profile_description='Manager' where user_id=4
  24.  
  25. Update tbl_profile Set profile_description='Manager' where user_id=4
  26.  
  27. Create View Junk as SELECT * from [TableName]
  28.  
  29. Insert into junk (Code,name) values
  30. ('glyn','Glyn Roberts'),
  31. ('Mary','Maryann Roberts')
  32.  
  33. DELETE from Junk Where ID>4
Add Comment
Please, Sign In to add comment