Guest User

Insert Data into SQL Table

a guest
Feb 27th, 2012
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. ID ContactName1 Designation1 ContactName2 Designation2
  2. 1 A dummy B sam
  3.  
  4. ID ContactName Designation
  5.  
  6. @ContactName1
  7. @Designation1
  8.  
  9. @ContactName2
  10. @Designation2
  11.  
  12. INSERT INTO DataTable (ContactName, Designation) VALUES
  13. (@ContactName1, @Designation1),
  14. (@ContactName2, @Designation2);
  15.  
  16. SELECT MAX(ID) AS max_id FROM DataTable
  17.  
  18. INSERT INTO Table(ID, ContactName, Designation)
  19. VALUES(1, @ContactName1, @Designation1)
  20. VALUES(1, @ContactName2, @Designation2);
Add Comment
Please, Sign In to add comment