xxxxxxxxxx
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'your_table_name';
xxxxxxxxxx
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Your Table Name'
ORDER BY COLUMN_NAME
-- IS_NULLABLE returns yes or no depending on null or not null
xxxxxxxxxx
/* How to select the column names in SQL*/
SELECT Column_name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = N'your_table_name'
/* Just change the "your_table_name" ↑ to the name of your table */
xxxxxxxxxx
SELECT name, crdate FROM SYSOBJECTS WHERE xtype = 'U';
-- or
SELECT * FROM INFORMATION_SCHEMA.TABLES
-- or
SELECT * FROM databaseName.INFORMATION_SCHEMA.TABLES;
xxxxxxxxxx
SELECT
TABLE_SCHEMA AS TABLE_SCHEMA
,TABLE_NAME AS TABLE_NAME
,COLUMN_NAME AS COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
--Where COLUMN_NAME Like '%Put_Your_Comumn_Name_HERE%'
ORDER BY
TABLE_SCHEMA
,TABLE_NAME
,COLUMN_NAME;
xxxxxxxxxx
SELECT COLUMN_NAME AS 'ColumnName'
FROM INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME LIKE '%assembly_armatureassy_tbl%'
and COLUMN_NAME LIKE '%supplied%'
xxxxxxxxxx
-- sql server
sp_columns feeAgreement
-- or
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'feeAgreement'
xxxxxxxxxx
import sqlite3
# Connect to the database
connection = sqlite3.connect('your_database.db')
cursor = connection.cursor()
# Replace 'your_table' with the actual table name
table_name = 'your_table'
# Execute a query to retrieve the column names
cursor.execute(f"PRAGMA table_info({table_name})")
# Fetch all rows containing column information
columns = cursor.fetchall()
# Extract the column names (2nd item in each row)
column_names = [column[1] for column in columns]
# Print the column names
for column_name in column_names:
print(column_name)
# Close the database connection
connection.close()