Reputation: 33
I have just created this table:
create table dbo.OrderTypes
(
ID smallint primary key identity,
Name varchar(300) not null,
CreatedOn datetime default getdate(),
CreatedBy nvarchar(300) not null,
ModifiedOn datetime default getdate(),
ModifiedBy nvarchar(300) not null
)
What I am trying to do is populate the Name field with results from this query:
select distinct ordertype from unit_results
as well as inserting CreatedBy and ModifiedBy by hand (they will be the same for every row).
How might I go about doing this?
Upvotes: 0
Views: 526
Reputation: 3892
INSERT INTO dbo.OrderTypes (Name, CreatedBy, ModifiedBy)
SELECT DISTINCT ordertype, 'CreatedBy Value Here', 'ModifiedBy Value Here'
FROM unit_results
Upvotes: 2