SQL UPDATE SELECT


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. CREATE PROCEDURE [dbo].[aStoredProcedure]
  2. @param1 AS NVARCHAR(4),
  3. @param2 AS NVARCHAR(4),
  4. @param3 AS DATETIME
  5. AS
  6. BEGIN
  7. SET NOCOUNT ON;
  8.  
  9. INSERT INTO
  10. ACommonTable
  11. (
  12. param1, param2, param3, otherfield1, otherfield2, otherfield3
  13. )
  14. SELECT
  15. @param1, @param2, @param3,
  16. sph.otherfield1, sph.otherfield2, sph.otherfield3
  17. FROM
  18. AnotherTable AS sph
  19. WHERE
  20. sph.otherfield4 = @param1;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.