I'm working on a stored procedure in SQL Server 2000 with a temp table defined like this:
CREATE TABLE #MapTable (Category varchar(40), Code char(5))
After creating the table I want to insert some standard records (which will then be supplemented dynamically in the procedure). Each category (about 10) will have several codes (typically 3-5), and I'd like to express the insert operation for each category in one statement.
Any idea how to do that?
The best idea I've had so far is to keep a real table in the db as a template, but I'd really like to avoid that if possible. The database where this will live is a snapshot of a mainframe system, such that the entire database is blown away every night and re-created in a batch process- stored procedures are re-loaded from source control at the end of the process.
The issue I'm trying to solve isn't so much keeping it to one statement as it is trying to avoid re-typing the category name over and over.