Tuesday, February 13, 2024

How to add multiple values in insert query in SQL

INSERT INTO Court (Name, IsActive, CreatedDate, CreatedBy, CourtTypeId)  (select Name, IsActive, getdate() AS CreatedDate, CreatedBy, 3 AS CourtTypeId  from Lookup where lookupcategory =36 and parentlookupid = 87)


or



 INSERT INTO graduates (id, name, age)

SELECT id, name, age
FROM students
WHERE age >= 18;

No comments:

Post a Comment