Search
 
SCRIPT & CODE EXAMPLE
 

SQL

get tables in database sql

SELECT
  *
FROM
  INFORMATION_SCHEMA.TABLES;
Comment

sql get tables from current database you working with

-- note for Microsoft SQL Server
-- getting tables in database you are working with

DECLARE @dbname AS varchar(max)
SET @dbname = (SELECT DB_NAME())
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_CATALOG=@dbname

-- getting tables in specific database

DECLARE @dbname AS varchar(max)
SET @dbname = 'my specific database name'
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_CATALOG=@dbname



Comment

PREVIOUS NEXT
Code Example
Sql :: STOP message of how many rows affected sql 
Sql :: get all records who register today in mysql 
Sql :: mysql return text after a final full stop 
Sql :: postgres update column with value from another table 
Sql :: oracle current date 
Sql :: left join with only first record 
Sql :: copy from folders in sql server 
Sql :: insert all or first in oracle sql 
Sql :: change mysql root password 
Sql :: oracle list data files 
Sql :: sql copy table 
Sql :: mysql find foreign key references 
Sql :: mysql f# examples 
Sql :: display users in mysql 
Sql :: mysql select for update ejemplo 
Sql :: first letter capital in mysql query 
Sql :: sql week commencing date 
Sql :: create database store 
Sql :: default password of mysql 
Sql :: oracle add months to sysdate 
Sql :: oracle list service names 
Sql :: postgres make sql dump 
Sql :: Uncaught Error: Call to undefined function DatabaseOldmysqli_connect() 
Sql :: postgres date difference seconds 
Sql :: import file mysql terminal 
Sql :: find logged in users mysql 
Sql :: oracle alter tablespace add datafile autoextend max size 
Sql :: mysql tables max count 
Sql :: An error occurred while installing mysql2 (0.5.3) 
Sql :: sql select data from last week 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =