Tuesday, February 13, 2024

How to add multiple values in insert query in SQL - INSERT RECORD FROM ONE TABLE TO ANOTHER - COPY TABLE

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