0
java를 통해 테이블 함수를 작성할 수있는 경우 테스트 용으로 간단한 sql 문을 사용했습니다.
그러나 함수 작성을 완료하는 데 시간이 오래 걸리고 다른 db 사용자가 시간 초과됩니다.
의견이 있으십니까? 내가 SQLSERVER 2008을 사용하고
는 어떤 도움을 매우 높이 평가된다SQL을 통해 SQL 서버 테이블 함수를 작성하십시오.
try {
Statement statement = conn.createStatement();
CallableStatement cs ;
String retValue ;
cs = conn.prepareCall("{? = call dbo.isTableFunctionExists(?)}");
cs.registerOutParameter(1, Types.INTEGER);
lcString = "PAY_UDTF_"+this.textField1.getValue().toString() ;
cs.setString(2, lcString);
cs.execute();
retValue = cs.getString(1);
if (retValue.equals("1")) {
System.out.println("EXISTS");
lcSql = " ALTER ";
}else{
System.out.println("NOT FOUND");
lcSql = " CREATE ";
}
lcSql = lcSql + " FUNCTION [dbo].[" ;
lcSql = lcSql + lcString +"] (@pDate date)";
lcSql = lcSql + " RETURNS TABLE AS RETURN (";
lcSql = lcSql + " SELECT * FROM dbo.HR_EMPLOYMENT hre ";
lcSql = lcSql + " Where @pDate between hre.effective_start_date and hre.effective_end_date) ";
//statement.execute(lcSql);
statement.executeUpdate(lcSql);
statement.close();
System.out.println("COMPLETED");
} catch (Exception e) {
System.out.println("EXCEPTION"+e);
}
return null;
을 표현한다.
감사합니다,
엘머
? 그것을 바꿔 보셨습니까? 병목 현상이 어디 있는지 아십니까? SQL Server에 있습니까? wireshark를 실행 해보십시오. – javamonkey79
Microsoft SQL Server JDBC 드라이버 2.0을 사용하고 있습니다. 나는 SQL 서버 관리 스튜디오에서 함수를 만들려고했지만 괜찮 았어. 나는 wireshark에 익숙하지 않다. – Elmer