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

  • SEARCH
  • Home
  • 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 6807597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:51:07+00:00 2026-05-26T19:51:07+00:00

I have a situation where I need to generate a table from a stored

  • 0

I have a situation where I need to generate a table from a stored procedure for several different clients. These tables all have the same core values but sometimes they have additional columns.

I’d rather not be copying and pasting those table generating bits of SQL every time so my current setup is that I have a stored procedure that returns the core columns and this gets loaded into ##TempTableClientName (necessary because it is an external app accessing these and each command sent to the server seems to be seen as a different connection so a standard session temp table doesn’t seem to do the job).

I now want to run a second stored procedure to update that temp table to add in the new columns. There will likely be several of these procedures and they likely will be shared in some cases. To this end in order to share them I would need to somehow tell it which ##table to update.

My current options seem to be:

I can pass this as a string and use dynamic sql but this seems messy.

I can enforce one stored procedure per client and then the table name (which is per client) can be hardcoded into the procedure. This seems like it has potential for non-optimal code (ie lots of very similar or even identical procedures).

Can anybody suggest any better options than these? currently I am looking at the second since there aren’t a huge amount of clients and this would seem to be the easiest way to do things. I’d like some better options though… I was hoping there may be some function or something that will take a string and get the table object of that name…

  • 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-05-26T19:51:08+00:00Added an answer on May 26, 2026 at 7:51 pm

    My final solution was just to refactor my code to make my core procedure return all columns that can be used for any client. This means that often it will return data that is not relevant (or is null). Also this method causes potential problems if a new client requires extra columns that some code may need updating if it assumes a given number of columns.

    Its not a good solution unfortunately but its the one I went with for lack of other options.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my situation. I have different tables, by example: TABLE A Name |
I have a situation where I need to generate a bunch of C# code
Im using ITextSharp to generate a PDF, and have a situation where a need
I have situation where I need to change the order of the columns/adding new
I have a situation where I need to be able to load assemblies in
I have a situation where I need to work with a datagrid and adding
I have a situation where i need to debug a Windows CE application in
I have a situation where I need to add an arbitrary unique id to
I have a situation where I need to do something like select 2, id
I have a situation where i need to enforce a unique constraint on a

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.