SQL Server 2000: Insert Records

Populating system reference tables from test to live:

Get the values to insert ready formatted:

 

SELECT     'Select ''' + Which + ''',''' + What + ''' UNION ALL'
FROM         tbFunctions

 

------------------------------------------------------------------------
Select 'Valuation','View' UNION ALL
Select 'Valuation','Create' UNION ALL
Select 'Main','Reports' UNION ALL
Select 'Valuation','View Audit' UNION ALL
Select 'System','View Values' UNION ALL
Select 'System','Manage Rights' UNION ALL
Select 'Appraisals','View' UNION ALL
Select 'System','Archway Update' UNION ALL
Select 'System','Use Testing Overrides' UNION ALL
Select 'System','Edit Values' UNION ALL
Select 'Valuation','Complete' UNION ALL
Select 'Valuation','Edit' UNION ALL
Select 'Valuation','Uncomplete' UNION ALL
Select 'System','Manage Prefixes' UNION ALL
Select 'Valuation','View' UNION ALL
Select 'Valuation','Create' UNION ALL
Select 'Main','Reports' UNION ALL
Select 'Valuation','View Audit' UNION ALL
Select 'System','View Values' UNION ALL
Select 'System','Manage Rights' UNION ALL
Select 'Appraisals','View' UNION ALL
Select 'System','Archway Update' UNION ALL
Select 'System','Use Testing Overrides' UNION ALL

Create insert and paste values per above removing the last 'UNION ALL':

 

INSERT INTO [tbFunctions]
           ([Which]
           ,[What])
Select 'Valuation','View' UNION ALL
Select 'Valuation','Create' UNION ALL
Select 'Main','Reports' UNION ALL
Select 'Valuation','View Audit' UNION ALL
Select 'System','View Values' UNION ALL
Select 'System','Manage Rights' UNION ALL
Select 'Appraisals','View' UNION ALL
Select 'System','Archway Update' UNION ALL
Select 'System','Use Testing Overrides' UNION ALL
Select 'System','Edit Values' UNION ALL
Select 'Valuation','Complete' UNION ALL
Select 'Valuation','Edit' UNION ALL
Select 'Valuation','Uncomplete' UNION ALL
Select 'System','Manage Prefixes'