Decisionisti
asked on
Java JDBC: number of rows returned by a "CREATE TABLE AS SELECT" instruction
Hi,
Executing in Java, on a Oracle database, the sql statement:
int rows = stm.executeUpdate("CREATE TABLE A as select * from MONTHS")
the table A in created and the int variable "rows" contains the number of written rows in the table.
Executing the same statement in SQL Server, with the correct sintax:
int rows = stm.executeUpdate("SELECT * into A from MONTHS");
The rows variable is "-1".
The different databases implement in a different way that JDBC method and don't return the number of written rows? Is there a way to do that on SQL Server?
Thank you in advance
Antonio Vivalda
Executing in Java, on a Oracle database, the sql statement:
int rows = stm.executeUpdate("CREATE TABLE A as select * from MONTHS")
the table A in created and the int variable "rows" contains the number of written rows in the table.
Executing the same statement in SQL Server, with the correct sintax:
int rows = stm.executeUpdate("SELECT * into A from MONTHS");
The rows variable is "-1".
The different databases implement in a different way that JDBC method and don't return the number of written rows? Is there a way to do that on SQL Server?
Thank you in advance
Antonio Vivalda
ASKER
Yes the insert return the number of rows, but I need it in the "select * into A from MONTHS" sql statement
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
No comment
and then run "insert into table_a select *..." in a separate stateemnt - will that one return number of rows?
I guess you even can sya "where rownum = 0";
or you can then truncate this row or delete it
I hope insert into should return number of rows