How to get all the column names of a data table as follows: First get the systemID of the data table from the SystemObject system table, and then all column names in the data table are obtained in the SYSCOLUMN table. SQL statement is as follows: declare @objid int, @ objname char (40) set @objname = 'tablename'select @objid = id from sysobjects where id = object_id (@objname) select' Column_name '= name from syscolumns where id = @objid ORDER by colid
You can modify it yourself, you can put it directly in JSP to execute select name from syscolumnswhere (id = (select id from sysobjects where (id = Object_id ('YourTableName'))) Order by Colid