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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:51:00+00:00 2026-05-10T23:51:00+00:00

As the topic suggests I wish to be able to pass table names as

  • 0

As the topic suggests I wish to be able to pass table names as parameters using .NET (doesn’t matter which language really) and SQL Server.

I know how to do this for values, e.g. command.Parameters.AddWithValue('whatever', whatever) using @whatever in the query to denote the parameter. The thing is I am in a situation where I wish to be able to do this with other parts of the query such as column and table names.

This is not an ideal situation but it’s one I have to use, it’s not really prone to SQL injection as only someone using the code can set these table names and not the end-user. It is messy however.

So, is what I am asking possible?

EDIT: To make the point about SQL injection clear, the table names are only passed in by source code, depending on the situation. It is the developer who specifies this. The developer will have access to the database layer anyway, so the reason I am asking is not so much for security but just to make the code cleaner.

  • 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. 2026-05-10T23:51:00+00:00Added an answer on May 10, 2026 at 11:51 pm

    I don’t think I’ve ever seen this capability in any SQL dialect I’ve seen, but it’s not an area of expertise.

    I would suggest restricting the characters to A-Z, a-z, 0-9, ‘.’, ‘_’ and ‘ ‘ – and then use whatever the appropriate bracketing is for the database (e.g. [] for SQL Server, I believe) to wrap round the whole thing. Then just place it directly in the SQL.

    It’s not entirely clear what you meant about it not being a SQL injection risk – do you mean the names will be in source code and only in source code? If so, I agree that makes things better. You may not even need to do the bracketing automatically, if you trust your developers not to be cretins (deliberately or not).

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

Sidebar

Ask A Question

Stats

  • Questions 59k
  • Answers 59k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I tend to go with calling the properties cause once… May 11, 2026 at 8:59 am
  • added an answer the following code casts magic <meta name='viewport' content='width=device-width, minimum-scale=1.0, maximum-scale=1.0'/> May 11, 2026 at 8:59 am
  • added an answer See Three Body Problem on Wikipedia. When you have more… May 11, 2026 at 8:59 am

Related Questions

As the topic suggests I wish to be able to pass table names as
Please excuse my ignorance on the topic, as I am relatively new to Hibernate
As the title mentions, I have a timeout callback handler on an ajax call,
As the title says on a website is it possible to tell if a
As the title says: What is the difference between a non-secure random number generator
As the question states - is there a good tool out there which lists
As the title states, is there a way to prevent extra elements from showing
As the subject says, really! What do they do?
As the title: How would I tell NHibernate, once and for all, that all
As the title describes, what are the different doctypes available and what do they

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.