Automate this Process

Hi,

I have 3 Insert statements which are dependently written as views and I have to run these views manually..

I want to automate this process - How can I achieve this? Write a Script ?

The 3 views are shown below;

INSERT INTO  dbo.CPRDLkupEthnicity (EthnicityCode,EthnicityDesc)
SELECT EthnicityCode,EthnicityDesc
FROM dbo.CPRDEthnicityCodesExtract WITH (TABLOCK)
INSERT INTO  dbo.CPRDLkupJobCategory(JobCategory)
SELECT JobCategoryName
FROM dbo.CPRDJobCategoryExtract WITH (TABLOCK)
INSERT INTO  dbo.CPRDLkupConsultationType (ConsultationType)
SELECT ConsultationTypeDescription
FROM dbo.CPRDConsultationTypeExtract WITH (TABLOCK)

Thank you so much

I'm confused. A view cannot contain and INSERT statement. Please post the CREATE VIEW commands.

Sorry these are not views - they are queries..

I would like to make all these 3 queries run within one script please help ..

Many thanks

Just put them in a file with extension .sql Voila! A script

Is this what you mean ?

USE EMISRESDBMaster
GO

-- Create the Ethnicity lookup table 

	INSERT INTO  dbo.CPRDLkupEthnicity (EthnicityCode,EthnicityDesc)
	SELECT EthnicityCode,EthnicityDesc
	FROM dbo.CPRDEthnicityCodesExtract WITH (TABLOCK)

-- Create the Job Category look up table 

	INSERT INTO  dbo.CPRDLkupJobCategory(JobCategory)
	SELECT JobCategoryName
	FROM dbo.CPRDJobCategoryExtract WITH (TABLOCK)

-- Create consultation look up table 

	INSERT INTO  dbo.CPRDLkupConsultationType (ConsultationType)
	SELECT ConsultationTypeDescription
	FROM dbo.CPRDConsultationTypeExtract WITH (TABLOCK)
GO

Thank you so much