Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8907447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:55:10+00:00 2026-06-15T02:55:10+00:00

The integration software that my client is using is pulling over ISAM files from

  • 0

The integration software that my client is using is pulling over ISAM files from a RMS system and creating lots of tables that all have identical schemas, but nonetheless the software they use doesn’t support merging them together.

Here’s some example table names:

  • SOME_TABLE_XYZ_2012OCT
  • SOME_TABLE_ABC_2012OCT
  • SOME_TABLE_LMN_2012OCT
  • SOME_TABLE_XYZ_2012NOV
  • SOME_TABLE_ABC_2012NOV
  • SOME_TABLE_LMN_2012NOV

I need to roll these all up into a single view named SOME_TABLE, with the data union all’d together. It must be dynamic because there can be new 3 char codes and obviously, monthly new tables being created.

Ideally I’d like a SP that creates a view named SOME_TABLE, then I can query off of SOME_TABLE to do the work that I need on it (scheduled ETL into a sql server 2012 data warehouse). I know that I could just have the SP return a cursor, but creating the view gives me flexibility to make it an indexed view if I need for performance, and ease of use from other ETL tools.

I figure on querying sys.tables (or whatever it is), and working from there to build up a sql statement for a create view.

Any other bright ideas on how to approach this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:55:11+00:00Added an answer on June 15, 2026 at 2:55 am

    You can use this query batch to create the view. But you need to keep updating it.

    declare @v nvarchar(max) =
        (
            select stuff((
            select cast(' union all select * from ' as nvarchar(max)) + quotename(name)
              from sys.tables
             where name like 'SOME\_TABLE\____\_[0-9][0-9][0-9][0-9][a-Z][a-Z][a-Z]' escape '\'
               for xml path('a'), type
            ).value('.','nvarchar(max)'),1,11,'')
        );
    set @v = 'CREATE VIEW SOME_TABLE AS ' + @v;
    exec (@v);
    

    This is a stored proc that takes the base table name, and creates a view for it (I wrapped the above code into a proc that takes a parameter)

        SET ANSI_NULLS ON
        GO
        SET QUOTED_IDENTIFIER ON
        GO
        CREATE PROCEDURE spCreateUnionedView
            @BaseTableName varchar(100)
        AS
        BEGIN
            SET NOCOUNT ON;
    
            declare @v nvarchar(max) =
            (
                select stuff((
                select cast(' union all select * from ' as nvarchar(max)) + quotename(name)
                  from sys.tables
                 where name like replace(@BaseTableName, '_', '\_') + '\____\_[0-9][0-9][0-9][0-9][a-Z][a-Z][a-Z]' escape '\'
                   for xml path('a'), type
                ).value('.','nvarchar(max)'),1,11,'')
            );
    
            declare @s nvarchar(max) = 'DROP VIEW ' + @BaseTableName;
            exec (@s);
    
            set @v = 'CREATE VIEW ' + @BaseTableName + ' AS ' + @v;
            exec (@v);
    
        END
        GO
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing some integration software for a client using amongst other things, C#,
The continuous integration software I am using runs JavaScript files through JSLint and complains
I develop a network based, multi-component software system that's designed to run on an
We are using a continuous integration process, and one of the steps for that
I'm using the Continuous Integration Software Hudson to build Maven 2 projects. The Hudson
I have decided to start using Team City as my continuous integration software and
Continuous Integration servers like Hudson are a pretty amazing addition to software development. I
When a software is developed,various types of testing is done - unit,integration,functional,manual.In my current
I am working with Integration of multiple applications which is using their own databases.
We are using SAP Integration KIT and Crystal Reports 2008. The Crystal Reports are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.