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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:43:32+00:00 2026-05-15T04:43:32+00:00

I want to read data from a table whose name is supplied by a

  • 0

I want to read data from a table whose name is supplied by a user. So before actually starting to read data, I want to check if the database exists or not.

I have seen several pieces of code on the NET which claim to do this. However, they all seem to be work only for SQL server, or for mysql, or some other implementation. Is there not a generic way to do this?

(I am already seperately checking if I can connect to the supplied database, so I’m fairly certain that a connection can be opened to the database.)

  • 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-15T04:43:32+00:00Added an answer on May 15, 2026 at 4:43 am

    You cannot do this in a cross-database way. Generally DDL (that is, the code for creating tables, indexes and so on) is completely different from database to database and so the logic for checking whether tables exist is also different.

    I would say the simplest answer, though, would simply be something like:

    SELECT * FROM <table> WHERE 1 = 0
    

    If that query gives an error, then the table doesn’t exist. If it works (though it’ll return 0 rows) then the table exists.

    Be very careful with what you let the user input, though. What’s to stop him from from specifying “sysusers” as the table name (in SQL Server, that’ll be the list of all database users)

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The fastest way to done here may be to just… May 16, 2026 at 5:23 pm
  • Editorial Team
    Editorial Team added an answer You need an SMTP Server. I use PostCast Server, which… May 16, 2026 at 5:22 pm
  • Editorial Team
    Editorial Team added an answer Yeah, you could do that, and it would mostly work,… May 16, 2026 at 5:22 pm

Trending Tags

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

Top Members

Related Questions

I have to migrate data from one database to another. As preparation we have
We have a database with the time related data in it. As you can
Possible Duplicate: How can I declare a thousand separator in read.csv? I actually have
I have a SQL Table Roles in DB. I want to find out if
hey all.i'm newbie at this problem.i have this data in table result: item range_code
I have two columns in my ForumPost Table: Id and ThreadId . I want
What solutions exist to persist data, without requiring a full-blown enterprise server? I am
I have a java program that connects to a MySql database and it's working
I am trying to find a way to get a random selection from a
I'm new to database design, and I haven't found a definitive way to structure

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.