i have a table Companiesdata
CREATE TABLE [dbo].[Companiesdata] ( [Company Name] nvarchar(255), [Industry] varchar(40), [ParentId] int NULL, )
the records are
i have other table
create table dbo.companycategories ( categoryID int identity(1,1), Industry varchar(40) )
Now i want a procedure to automatically insert data into companycategories table if i inserted in companiesdata table.
i.e my output should be
If i insert into companiesdata values ('ijk technologies','finance',4)
then the industry field should automatically get inserted into companycategories table
select * from companycategories
asked Aug 03 '12 at 11:16 AM in Default
Instead of the trigger solution I would recommend you create a stored procedure that inserts CompaniesData and CompanyCategories at the same time. All inserts to CompaniesData should be through this stored procedure.
answered Aug 06 '12 at 05:31 AM