我是Java新手.我在数据库中从数据库中检索我的第一列,表示数据为:
2014-09-01 10:00:00.000
Run Code Online (Sandbox Code Playgroud)
现在我想只显示时间:
10:00:00
Run Code Online (Sandbox Code Playgroud)
怎么做?我检索我的列的代码是:
public String[] getChartTime() throws SQLException {
List < String > timeStr = new ArrayList < String > ();
String atime[] = null;
getConnection();
try {
con = getConnection();
String sql = "exec vcs_gauge @gauge_name=?,@first_rec_time=?,@last_rec_time=?";
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println("date is " + df.format(currentDate));
clstmt = con.prepareCall(sql);
clstmt.setString(1, "vs3_bag");
clstmt.setString(2, "2014-09-01 10:00:00");
clstmt.setString(3, "2014-09-01 11:00:00");
clstmt.execute();
rs = clstmt.getResultSet();
while (rs.next()) {
// Just get the value of the column, and add it …Run Code Online (Sandbox Code Playgroud)我想在SQL Server2012中创建一个表,其列名包括括号as
create table temp_sp
(
logtime datetime,
vcs_api varchar,
L3(S1)Status varchar,
L3(S2)Status varchar,
beam_current real,
beam_energy real,
st1_vs1_bag1_rb real,
ring_avg_pressure real
)
Run Code Online (Sandbox Code Playgroud)
但是当我使用括号时L3(S1)Status,L3(S2)Status我得到一个错误
'('.'''''''或'''附近的语法不正确.**
怎么解决?