21 lines
1.0 KiB
Java
21 lines
1.0 KiB
Java
import java.io.FileInputStream;
|
|
import java.sql.*;
|
|
import java.util.Properties;
|
|
public class LogCols {
|
|
public static void main(String[] args) throws Exception {
|
|
Properties props = new Properties();
|
|
try (FileInputStream in = new FileInputStream(args[0])) { props.load(in); }
|
|
try (Connection conn = DriverManager.getConnection(props.getProperty("url"), props.getProperty("username"), props.getProperty("password"))) {
|
|
for (String t : new String[]{"s_log_login", "s_log_technical", "s_log_audit"}) {
|
|
System.out.println("== " + t + " ==");
|
|
try (Statement st = conn.createStatement(); ResultSet rs = st.executeQuery(
|
|
"SELECT c.name FROM sys.columns c WHERE c.object_id=OBJECT_ID('" + t + "') ORDER BY c.column_id")) {
|
|
StringBuilder sb = new StringBuilder(" ");
|
|
while (rs.next()) sb.append(rs.getString(1)).append(" ");
|
|
System.out.println(sb);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|