Busy learning curve this week, it seems.
Trying to pick up SQL (by the way, does anyone -happen- to know how to query all tables in a database? Cause I really sortof need to), started aiki last night (don't look at me, it was the father's idea, he said he'd pay for a month as a birthday present), have PHP to start today.
Busybusybusy.
I -need- a busy-bee icon.
Note to self.
Busybusybusy.
I -need- a busy-bee icon.
Note to self.
But I am going to send this link to someone who does.
First, what DBMS are you using? And, when you say "query all tables" do you mean "get a list of all tables" or "execute a query on each table"? The former is possible in almost every DBMS, while the latter requires much more hoop-jumping.
Hi Dossy - thanks for responding :-)
Looking to do the latter, but the former would be useful as well.
Forgive me for dumb questions - I can do a fair amount on the computer, but databases are somewhat new to me. DBM stands for Database Manager? We've been working with it through the Microsoft SQL Server Enterprise Manager v8.0. If that's not what you need, can you give me an idea of what specification you're looking for? The database file itself is a mdf.
Re: Hi Dossy - thanks for responding :-)
Here's a web page that outlines a "manual" way of applying a query to all tables in the database. Here's another way that offers a programmatic approach to dynamic SQL.
Hope this helps.
Re: Hi Dossy - thanks for responding :-)
In case those two links don't really help clarify things, let me distill their essence for you:
The sysobjects table contains metadata about the objects in the database. Where type = 'U' will select user-created tables. The core of "dynamic SQL" is to put a SQL statement inside a variable then execute it. So, to select the count of rows of all tables in the database, you might do this:
Of course, this approach means having to learn Transact-SQL (aka T-SQL) which is probably not where you want to start, as a newbie. It's likely to be orders of magnitude easier to do this in a higher-level language (like PHP) -- get the list of table names using a query against sysobjects then iterate over that list using foreach or something in PHP, executing the query you want against each table.