Answers for "sql check if column exists"

SQL
1

sql check if column exists

IF COL_LENGTH('<table_name>', '<column_name>') IS NULL
BEGIN
	--column doesnot exists, so, add column here
	ALTER TABLE <table_name> ADD <column_name> BIT NOT NULL DEFAULT(0)
END
Posted by: Guest on August-10-2021
0

sql check if column exists

* Using the below query, You can check whether the table1 has a column named "id"

SHOW COLUMNS FROM table1 LIKE 'id'
Posted by: Guest on March-11-2021

Code answers related to "sql check if column exists"

Code answers related to "SQL"

Browse Popular Code Answers by Language