0

I want to create an index for my SQL Table Column I have also asked a Question before here: https://stackoverflow.com/questions/17842488/index-similar-records-sql-server

I just need to know that I have created a Query that I want to copy my all data from my existing table to a new table! the query is to be executed using Java Platform!

 Statement stat=con.createStatement();
 ResultSet ss;
 String s="Select * INTO log2 FROM log SELECT *, DENSE_RANK() OVER (ORDER BY ip) basescore from log";
 ss=stat.executeQuery(s);

The problem is that it creates a table named log2 as a new table for me and a column basescore WITHOUT any values to be generated! I don't why it is not working with Java because I have tried it with SQL Server Query and it executes Successfully! Please can somebody help me please I will be thankful to him please

4

1 回答 1

2

如果您想要创建一个新表log2,其中的值来自log加上密集排名,因为basescore查询应该如下所示:

SELECT *, DENSE_RANK() OVER (ORDER BY ip) basescore INTO log2 FROM log

如果您只想要唯一的行,您可以在DISTINCT之后添加关键字SELECT(而不是使用*您可能希望在查询中指定列名)。

于 2013-07-25T09:45:32.390 回答