Advertisement
Guest User

Untitled

a guest
Aug 31st, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. DECLARE @Table TABLE (ID int);
  2. INSERT INTO @Table (ID)
  3. SELECT RecordID FROM tblData
  4.  
  5. SELECT * FROM @Table
  6.  
  7. import java.sql.Connection;
  8. import java.sql.DriverManager;
  9. import java.sql.ResultSet;
  10. import java.sql.SQLException;
  11. import java.sql.Statement;
  12. import java.io.BufferedReader;
  13. import java.io.FileReader;
  14. import java.io.FileNotFoundException;
  15. import java.io.IOException;
  16.  
  17.  
  18. public class Full_Code {
  19.  
  20.  
  21. public static void main (String[] args) throws ClassNotFoundException, SQLException, FileNotFoundException, IOException
  22. {
  23. Connection con = null;
  24. Statement stmt = null;
  25. ResultSet rs = null;
  26. String Query = "", s;
  27.  
  28. BufferedReader in = new BufferedReader(new FileReader("Query.txt"));
  29. while ((s = in.readLine())!=null) Query += s+"n"; in.close();
  30. in.close();
  31.  
  32. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  33. con = DriverManager.getConnection("jdbc:sqlserver://127.0.0.1;databaseName=MyDB;user=VriL;password=987;");
  34. stmt = (Statement) con.createStatement();
  35. rs = stmt.executeQuery(Query);
  36.  
  37. rs.close(); con.close(); stmt.close();
  38. }
  39.  
  40. }
  41.  
  42. ResultSet rs_version;
  43. String msmsql_sql="select @@VERSION as VERSION";
  44. rs_version=stmt.executeQuery(msmsql_sql);
  45. while (rs_version.next()){
  46. out.println("<b>"+rs_version.getString("VERSION")+"</b>");
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement