D
D
Doston Elmurodov2015-11-28 13:38:49
SQL
Doston Elmurodov, 2015-11-28 13:38:49

How to select from all tables of one database in SQL Server?

How to select from all tables of one database in SQL Server?
For example:
Select * from database where column_name.xxx ='yyy'
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Natarov, 2015-11-28
@HanDroid

Just specify the tables separated by commas, then the column names must match.
In the code above, the condition is, if from table 1 Id is greater than in the user, we pull out the records.
Naturally insert your condition. )
And after FROM is not the name of the database (database), but the names of the tables.
After FROM, you can try to insert * , which means "everything", but I'm not sure if this will work.

I
igruschkafox, 2015-11-28
@igruschkafox

SELECT * FROM sys.tables t1
JOIN sys.columns t2 ON t1.object_id=t2.object_id
WHERE t2.column_name.xxx ='yyy'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question