Home > Query, SQL > BISQL # 84 – How to select ALL tables or Select all Top rows in one script ? All data from all table !

BISQL # 84 – How to select ALL tables or Select all Top rows in one script ? All data from all table !

Hi friends

                          Due to transformation into new project I really not getting time ..(This is my best reason from  stepping backs from post writing Smile)..

Now lets see by changing some time parameter for blog posting how can achieve stability in it !!

So lets continue with today SQL Scripting post !!

Sometimes I thought when we are having fast analysis into project , for example consider following situation where we have very less time to analysis like …

1.IF I have analyze the Entire Database very fast !!

2.IF I have been migrated into another project which is in very critical phase.

3.I wan step back and see what is my data in all tables

In short I want to see all the data  from all table

In such case most of the time we tends to always write “Select * from “ n and n number of times ..

So here is script which will reduce your time and ad give you select * from (for all table ).

Script

--Select ALL table from all column 
SELECT
    'Select * from ' + name
    FROM sys.sysobjects
    WHERE  xtype = 'U'
    order by name

Output

image

Following simple demonstration to select all

image

Now how to use this for top column

Just by playing with this query we can achieve lot more lot more useful script

--Select TOp 100 from ALL table from all rows  
SELECT
    'Select Top(100) * from ' + name
    FROM sys.sysobjects
    WHERE  xtype = 'U'
    order by name

Output

image

Or may be I can use this for all count

-- COUNT from ALL table from all rows  
SELECT
    'Select COUNT(1) from ' + name
    FROM sys.sysobjects
    WHERE  xtype = 'U'
    order by name

Output

image

Hope this Helps !!

Visit SQL tab for more SQL Script .

Thanks for visiting my blog !!

Hope you will like this post on Select All for all table.

If you really like reading my blog and understood at lest few thing then please don’t forget to subscribe my blog .

If you wan daily link and analysis or interesting link go to following website which will give @ your inbox please subscribe our following link resource blog

Where todays links are

Link Resource Website

Advertisement
Categories: Query, SQL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: