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 8862547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:45:19+00:00 2026-06-14T15:45:19+00:00

I require to create new tables for every client that signs up for my

  • 0

I require to create new tables for every client that signs up for my application.

For Example, I have two tables

Order_History_<ClientIdentifier>
Transcation_Log_<ClientIdentifier>

In SQL Server, how do I create tables with customized names on the go and how can I query them according to the client which is accessing my application.

  • 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-14T15:45:21+00:00Added an answer on June 14, 2026 at 3:45 pm

    very simple way:

    create procedure CreateTableForUser
    (
        @UserName nvarchar(100)
    )
    AS
    BEGIN
    
    declare @createScript nvarchar(max) =
    '
    create table dbo.Order_History_<ClientIdentifier>
    (
        id int PRIMARY KEY,
        val nvarchar(100)
    )
    '
    
    declare @createScript2 nvarchar(max) =
    '
    create table dbo.Transcation_Log_<ClientIdentifier>
    (
        id int PRIMARY KEY,
        val nvarchar(100)
    )
    '
    
    set @createScript = REPLACE(@createScript, '<ClientIdentifier>', @UserName)
    set @createScript2 = REPLACE(@createScript2, '<ClientIdentifier>', @UserName)
    
    exec sp_executesql @createScript
    exec sp_executesql @createScript2
    
    END
    

    if you need something more “automatic”, like creating the tables from a template table by copying all his fields and keys i would use the sys. views but it’s a bit longer to write 😛

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

Sidebar

Related Questions

I have an admin form that lets users create entities that require an image.
I am going to create a new web application that is very customized. It
I have a maintenance application that has to turn enterprise data (from various databases/tables)
I've got a function that creates two tables. I've made every variable between the
I'm looking to create a windows program that doesn't require any environmental dependencies (like
How do I create an easy login script that does not require a database.
I'm creating an Android application that requires me to create a bitmap of the
I have two tables with same schema , and primary key as noc for
I have a project here that connects to an in-production database and grabs tables
I must create android application for tablets, app will be shows new magazines and

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.