Á¬½Óoracle£¬sqlserverÖÐÊý¾Ý¿âµÄʾÀý´úÂë
Ò» ÔÚOracleÖÐÁ¬½ÓÊý¾Ý¿â
public class Test1 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(
Ö÷»úÃû ¶Ë¿Ú SID ÕʺŠÃÜÂë
"jdbc:oracle:thin:@haha:1521:oracle", "hehe", "a");
Statement stt = conn.createStatement();
ResultSet rs = stt.executeQuery("select * from emp");
while (rs.next()) {
System.out.print(rs.getObject(2).toString());
System.out.println("\t" + rs.getObject(3).toString());
}
rs.close();
stt.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
¶þ ÔÚsqlserverÖÐÁ¬½ÓÊý¾Ý¿â
public class DBManager {
String url="jjdbc:microsoft:sqlserver://localhost:1433;databaseName='student'";
String driver ="com.microsoft.jdbc.sqlserver.SQLServerDriver";
String useName="sa";
String pwd="sa";
Connection con =null;
Statement sta=null;
ResultSet rs=null;
public ResultSet getQiery(String sql)
{
try {
Class.forName(driver);
con =DriverManager.getConnection(url,useName,pwd);
sta = con.createStatement();
rs =sta.executeQuery(sql);
} catch (Exception e) {
e.printStackTrace();
}
return rs;
}
public int getUpd(String sql)
{
int i=0;
try {
&nb
Ïà¹ØÎĵµ£º
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/yf520gn/archive/2008/09/26/2982363.aspx
SELECT * from TB_MILES_CB_ORDER
WHERE convert(varchar(100),ORDER_DATE,102)= £¿
ORDER BY ORDER_NO
SELECT CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
SELECT CONVERT(varchar(100), GETDATE ......
SQLSERVER ´óÊý¾ÝÁ¿²åÈëÃüÁ
BULK INSERTÊÇSQLSERVERÖÐÌṩµÄÒ»Ìõ´óÊý¾ÝÁ¿µ¼ÈëµÄÃüÁËüÔËÓÃDTS(SSIS)µ¼ÈëÔÀí£¬¿ÉÒÔ´Ó±¾µØ»òÔ¶³Ì·þÎñÆ÷ÉÏÅúÁ¿µ¼ÈëÊý¾Ý¿â»òÎļþÊý¾Ý¡£ÅúÁ¿²åÈëÊÇÒ»¸ö¶ÀÁ¢µÄ²Ù×÷£¬ÓŵãÊÇЧÂʷdz£¸ß¡£È±µãÊdzöÏÖÎÊÌâºó²»¿ÉÒԻعö¡£
¡¡¡¡BULK INSERTÊÇÓÃÀ´½«ÍⲿÎļþÒÔÒ»ÖÖÌض¨µÄ¸ñʽ¼ÓÔ ......
create function comm_getpy
(
@str nvarchar(4000)
)
returns nvarchar(4000)
as
begin
declare @word nchar(1),@PY nvarchar(4000)
set @PY=''
while len(@str)>0
begin
set @word=left(@str,1)
--Èç¹û·Çºº×Ö×Ö·û£¬·µ»ØÔ×Ö·û
& ......
· ±¾ÎÄÌÖÂÛÁËÈçºÎͨ¹ýTransact-SQLÒÔ¼°ÏµÍ³º¯ÊýOPENDATASOURCEºÍOPENROWSETÔÚͬ¹¹ºÍÒì¹¹Êý¾Ý¿âÖ®¼ä½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬²¢¸ø³öÁËÏêϸµÄÀý×ÓÒÔ¹©²Î¿¼¡£
1. ÔÚSQL ServerÊý¾Ý¿âÖ®¼ä½øÐÐÊý¾Ýµ¼Èëµ¼³ö
(1).ʹÓÃSELECT INTOµ¼³öÊý¾Ý
  ......
SQLServer2005ͨ¹ýintersect,union,exceptºÍÈý¸ö¹Ø¼ü×Ö¶ÔÓ¦½»¡¢²¢¡¢²îÈýÖÖ¼¯ºÏÔËËã¡£
ËûÃǵĶÔÓ¦¹Øϵ¿ÉÒԲο¼ÏÂÃæͼʾ
Ïà¹Ø²âÊÔʵÀýÈçÏ£º
use tempdb
go
if (object_id ('t1' ) is not null ) drop table t1
if (object_id ('t2' ) is not null ) drop table t2
go
cre ......