Search
 
SCRIPT & CODE EXAMPLE
 

SQL

get columns number sql

#With SQL

SELECT count(*)
FROM information_schema.columns
WHERE table_name = 'Your_table_name';
Comment

get columns number sql

//With JAVA

String quer="SELECT * FROM sample2 where 1=2";

Statement st=con.createStatement();
ResultSet rs=st.executeQuery(quer);
ResultSetMetaData rsmd = rs.getMetaData();
int NumOfCol=0;
NumOfCol=rsmd.getColumnCount();
System.out.println("Query Executed!! No of Colm="+NumOfCol);
Comment

sql number columns

SELECT TABLE_NAME , count(COLUMN_NAME)
FROM information_schema.columns
GROUP BY TABLE_NAME;

-- Oracle (depending on schema grants):
SELECT count(*) FROM USER_TAB_COLS WHERE TABLE_NAME = 'my_table';
SELECT count(*) FROM ALL_TAB_COLS WHERE TABLE_NAME = 'my_table';
SELECT count(*) FROM DBA_TAB_COLS WHERE TABLE_NAME = 'my_table';
Comment

PREVIOUS NEXT
Code Example
Sql :: oracle index size calculation 
Sql :: oracle select into 
Sql :: alter table mysql 
Sql :: query by column for substring sql 
Sql :: how to change db owner postgres 
Sql :: postgres top 10 
Sql :: mysql datetime with timezone offset 
Sql :: create temp table in sql 
Sql :: role "postgres" does not exist 
Sql :: drop CHECK constraint sql 
Sql :: mysql min value row 
Sql :: what is datetime in sql server 
Sql :: rename column name sql server 
Sql :: nosql vs sql 
Sql :: replace text in sql 
Sql :: df to sql pandas sql achemy 
Sql :: INITCAP in Oracle example 
Sql :: how to get initials in sql 
Sql :: sql get character at index 
Sql :: sql query to check if column contains alphabets 
Sql :: ms sql mac 
Sql :: query to delete a database in mysql 
Sql :: SQL Subquery and JOIN 
Sql :: sql server port 
Sql :: SQL Rename Column in a Table 
Sql :: select all tables linked server sql 
Sql :: change schema in sql server 
Sql :: sqlite 3 mac 
Sql :: import mysql database command line 
Sql :: sqlite get date only 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =