I have Java code to bulk-insert tab file to SQL Server. I want to get the count of how many records were inserted. I tried using @@rowcount but I'm getting an error that "Statement did not return a result set". If I run the bulk insert statement in management studio, I can get the count.
Statement stmt = sqlConnection.createStatement();
ResultSet rs = stmt.executeQuery ("BULK INSERT schema1.table1 FROM 'd:\temp1\file1.tab' SELECT @@rowcount");
Is there any way to get the inserted count?