Files
workspace/code/fms/.tmp-fkcheck/LogCols.java
T
2026-08-21 23:06:56 +08:00

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);
}
}
}
}
}