The key point here is to remember that the trigger you are writting to the table (OrderDetails) will have the newly inserted data in a table called 'inserted' so in your trigger you may have to use 'inserted' instead of 'OrderDetails'
Two ways you can create triggers
1.Using SQL
2.Using C# - Clr managed method as outlined by "ryanb31"
Hope the little code below helps using SQL
CREATE TABLE [dbo].[OrderDetails](
[ID] [int] IDENTITY(1,1) NOT NULL,
[item_number] [varchar](50) NULL
)
ON [PRIMARY]
CREATE TABLE [dbo].[quantity](
[ID] [int] IDENTITY(1,1) NOT NULL,
[OrderDetailID] [int] NULL,
[Quantity] [int] NULL
) ON [PRIMARY]
The trigger is as follows
Create trigger trUpdateQuantity
on OrderDetails for insert as
Begin
DECLARE @Code varchar(100)=(select Item_number from inserted)
insert into quantity(OrderDetailID,Quantity)
select inserted.id,1 from inserted
where @Code='NUE-QAR-1'
insert into quantity(OrderDetailID,Quantity)
select inserted.id,5 from inserted
where @Code='NUE-QAR-5'
End