Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : sql

½â¾öͬʱÐÞ¸ÄͬһSQL¼Ç¼µÄÎÊÌâ

ÔÚÑ°ÕÒPowerDesignerÏà¹ØÐÅÏ¢µÄʱºòżȻ·¢ÏÖµÄ.ʹÓÃtimestamp
΢ÈíMSDNÄÚÈÝ:
timestamp (Transact-SQL)
¹«¿ªÊý¾Ý¿âÖÐ×Ô¶¯Éú³ÉµÄΨһ¶þ½øÖÆÊý×ÖµÄÊý¾ÝÀàÐÍ¡£timestamp ͨ³£ÓÃ×÷¸ø±íÐмӰ汾´ÁµÄ»úÖÆ¡£ ´æ´¢´óСΪ 8 ¸ö×Ö½Ú¡£ timestamp Êý¾ÝÀàÐÍÖ»ÊǵÝÔöµÄÊý×Ö£¬²»±£ÁôÈÕÆÚ»òʱ¼ä¡£ ÈôÒª¼Ç¼ÈÕÆÚ»òʱ¼ä£¬ÇëʹÓà datetime Êý¾ÝÀàÐÍ¡£
 ±¸×¢
ÿ¸öÊý¾Ý¿â¶¼ÓÐÒ»¸ö¼ÆÊýÆ÷£¬µ±¶ÔÊý¾Ý¿âÖаüº¬ timestamp ÁеıíÖ´ÐвåÈë»ò¸üвÙ×÷ʱ£¬¸Ã¼ÆÊýÆ÷Öµ¾Í»áÔö¼Ó¡£ ¸Ã¼ÆÊýÆ÷ÊÇÊý¾Ý¿âʱ¼ä´Á¡£ Õâ¿ÉÒÔ¸ú×ÙÊý¾Ý¿âÄÚµÄÏà¶Ôʱ¼ä£¬¶ø²»ÊÇʱÖÓÏà¹ØÁªµÄʵ¼Êʱ¼ä¡£ Ò»¸ö±íÖ»ÄÜÓÐÒ»¸ö timestamp ÁС£ ÿ´ÎÐ޸Ļò²åÈë°üº¬ timestamp ÁеÄÐÐʱ£¬¾Í»áÔÚ timestamp ÁÐÖвåÈëÔöÁ¿Êý¾Ý¿âʱ¼ä´ÁÖµ¡£ ÕâÒ»ÊôÐÔʹ timestamp Áв»ÊʺÏ×÷Ϊ¼üʹÓã¬ÓÈÆäÊDz»ÄÜ×÷ΪÖ÷¼üʹÓᣠ¶ÔÐеÄÈκθüж¼»á¸ü¸Ä timestamp Öµ£¬´Ó¶ø¸ü¸Ä¼üÖµ¡£ Èç¹û¸ÃÁÐÊôÓÚÖ÷¼ü£¬ÄÇô¾ÉµÄ¼üÖµ½«ÎÞЧ£¬½ø¶øÒýÓøþÉÖµµÄÍâ¼üÒ²½«²»ÔÙÓÐЧ¡£ Èç¹û¸Ã±íÔÚ¶¯Ì¬ÓαêÖÐÒýÓã¬ÔòËùÓиüоù»á¸ü¸ÄÓαêÖÐÐеÄλÖᣠÈç¹û¸ÃÁÐÊôÓÚË÷Òý¼ü£¬Ôò¶ÔÊý¾ÝÐеÄËùÓиüл¹½«µ¼ÖÂË÷Òý¸üС£
ʹÓÃijһÐÐÖÐµÄ timestamp ÁпÉÒÔºÜÈÝÒ×µØÈ·¶¨¸ÃÐÐÖеÄÈκÎÖµ×ÔÉ ......

SQL»ù´¡

##   ɾ³ýÊý¾Ý¿â
drop  database  ecport;
##   ´´½¨Êý¾Ý¿â
create   database   ecport;
##   ʹÓÃÊý¾Ý¿â
use   ecport;

##   ¹ú¼Ò±í½á¹¹
create   table COUNTRY(
               country_id     int  primary key auto_increment,
               name           varchar(64)
             
               );
##   Ä£Äâ¹ú¼Ò±íÊý¾Ý              
INSERT INTO COUNTRY( name ) VALUES ('Öйú');

##   Ê¡·Ý±í½á¹¹
create   table PROVINCE(

javaÖÐÈçºÎÒÔwindows¼¯³É·½Ê½Á¬½ÓSQL Server

ÔÚ¡¶JDBC Driver For SQL2000/2005/2008
¡·Ò»ÎÄÖУ¬ÑûÔ½éÉÜÁËÈçºÎÏÂÔز¢Ê¹ÓÃjdbcÁ¬½ÓSQL Server,
½ñÌìÓÐÈËÎÊÆð£¬ÈçºÎÒÔwindows¼¯³É·½Ê½Á¬½ÓSQL Server,Õâ¸öÒÔÇ°ÕæûÊÔ¹ý¡£
ÓÚÊÇ£¬´ò¿ªnetBeans²âÊÔÁËһϣ¬´úÂëÈçÏ£º
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testsqlconn;
import java.sql.*;
import com.microsoft.sqlserver.jdbc.*;
/** *//**
*
* @author: Administrator:downmoon(3w@live.cn)
* @date:2009-9-23 18:42:32
* @Encoding:UTF-8
* @File:TestSqlbyDS/TestSqlbyDS.java
* @Package:testsqlconn
*/
public class TestSqlbyDS {
public TestSqlbyDS(){}
public void GetResutls()
{
// Declare the JDBC objects.
Connection con = null;
CallableStatement cstmt = null;
ResultSet rs = null;
try {
// Establish the connection.
SQLServerDataSource ds = new SQLServerDataSource();
ds.setIntegratedSecurity(true);
ds.setServerName( ......

javaÖÐÈçºÎÒÔwindows¼¯³É·½Ê½Á¬½ÓSQL Server

ÔÚ¡¶JDBC Driver For SQL2000/2005/2008
¡·Ò»ÎÄÖУ¬ÑûÔ½éÉÜÁËÈçºÎÏÂÔز¢Ê¹ÓÃjdbcÁ¬½ÓSQL Server,
½ñÌìÓÐÈËÎÊÆð£¬ÈçºÎÒÔwindows¼¯³É·½Ê½Á¬½ÓSQL Server,Õâ¸öÒÔÇ°ÕæûÊÔ¹ý¡£
ÓÚÊÇ£¬´ò¿ªnetBeans²âÊÔÁËһϣ¬´úÂëÈçÏ£º
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testsqlconn;
import java.sql.*;
import com.microsoft.sqlserver.jdbc.*;
/** *//**
*
* @author: Administrator:downmoon(3w@live.cn)
* @date:2009-9-23 18:42:32
* @Encoding:UTF-8
* @File:TestSqlbyDS/TestSqlbyDS.java
* @Package:testsqlconn
*/
public class TestSqlbyDS {
public TestSqlbyDS(){}
public void GetResutls()
{
// Declare the JDBC objects.
Connection con = null;
CallableStatement cstmt = null;
ResultSet rs = null;
try {
// Establish the connection.
SQLServerDataSource ds = new SQLServerDataSource();
ds.setIntegratedSecurity(true);
ds.setServerName( ......

SQL 2005 tips

USE tempdb
GO
CREATE TABLE AuctionItems
(
  itemid       INT          NOT NULL PRIMARY KEY NONCLUSTERED,
  itemtype     NVARCHAR(30) NOT NULL,
  whenmade     INT          NOT NULL,
  initialprice MONEY        NOT NULL,
  /* other columns */
)
--ÏîÄ¿ÀàÐÍ¡¢ÏîÄ¿µÄÖÆÔìÈÕÆÚÒÔ¼°ËüµÄ³õʼ¼Û¸ñ¡£Ö»ÓÐÓëËùÓÐÏîÄ¿ÓйصÄÊôÐÔ±»´æ´¢ÔÚAuctionItems
CREATE UNIQUE CLUSTERED INDEX idx_uc_itemtype_itemid
  ON AuctionItems(itemtype, itemid)
INSERT INTO AuctionItems VALUES(1, N'Wine',     1822,      3000)
INSERT INTO AuctionItems VALUES(2, N'Wine',     1807,       500)
INSERT INTO AuctionItems VALUES(3, N'Chair',    1753,    800000)
INSERT INTO Aucti ......

Sql Server µÈ´ý״̬˵Ã÷

µÈ´ýÀàÐÍ  ˵Ã÷  
ASYNC_DISKPOOL_LOCK 
µ±³¢ÊÔͬ²½²¢ÐеÄỊ̈߳¨Ö´Ðд´½¨»ò³õʼ»¯ÎļþµÈÈÎÎñ£©Ê±³öÏÖ¡£ 
ASYNC_IO_COMPLETION 
µ±Ä³ÈÎÎñÕýÔڵȴý I/O Íê³Éʱ³öÏÖ¡£ 
ASYNC_NETWORK_IO 
µ±ÈÎÎñ±»×èÖ¹ÔÚÍøÂçÖ®ºóʱ³öÏÖÔÚÍøÂçдÈëÖС£ 
BACKUP 
µ±ÈÎÎñ×÷Ϊ±¸·Ý´¦ÀíµÄÒ»²¿·Ö±»×èֹʱ³öÏÖ¡£ 
BACKUP_OPERATOR 
µ±ÈÎÎñÕýÔڵȴý´Å´ø×°Èëʱ³öÏÖ¡£ÈôÒª²é¿´´Å´ø״̬£¬Çë²éѯ sys.dm_io_backup_tapes¡£Èç¹û×°Èë²Ù×÷ûÓйÒÆð£¬Ôò¸ÃµÈ´ýÀàÐÍ¿ÉÄÜָʾ´Å´ø»ú·¢ÉúÓ²¼þÎÊÌâ¡£ 
BACKUPBUFFER 
ÔÚ±¸·ÝÈÎÎñµÈ´ýÊý¾Ý»òµÈ´ýÓÃÀ´´æ´¢Êý¾ÝµÄ»º³åÇøʱ·¢Éú¡£´ËÀàÐͲ»³£¼û£¬Ö»Óе±ÈÎÎñµÈ´ý×°Èë´Å´øʱ²Å»á³öÏÖ¡£ 
BACKUPIO 
ÔÚ±¸·ÝÈÎÎñµÈ´ýÊý¾Ý»òµÈ´ýÓÃÀ´´æ´¢Êý¾ÝµÄ»º³åÇøʱ·¢Éú¡£´ËÀàÐͲ»³£¼û£¬Ö»Óе±ÈÎÎñµÈ´ý×°Èë´Å´øʱ²Å»á³öÏÖ¡£ 
BACKUPTHREAD 
µ±Ä³ÈÎÎñÕýÔڵȴý±¸·ÝÈÎÎñÍê³Éʱ³öÏÖ¡£µÈ´ýʱ¼ä¿ÉÄܽϳ¤£¬´Ó¼¸·ÖÖÓµ½¼¸¸öСʱ¡£Èç¹û±»µÈ´ýµÄÈÎÎñÕý´¦ÓÚ I/O ½ø³ÌÖУ¬Ôò¸ÃÀàÐͲ»Ö¸Ê¾·¢ÉúÎÊÌâ¡£ 
BAD_PAGE_PROCESS 
µ±ºǫ́´íÎóÒ³¼Ç¼Æ÷ÕýÔÚ³¢ÊÔ±ÜÃâÿ¸ôÎåÃëÒÔÉϵÄʱ¼äÔËÐÐʱ³öÏÖ¡£& ......

SQL 2005 Tips Bulk data transfer sample‏

CREATE PROC [dbo].[UP_EC_JOB_UpdateAddressType] 

 @Count INT  

AS 
BEGIN 
 
 SET NOCOUNT ON 
  
 DECLARE @TransactionNumber INT  
 DECLARE @Cursor CURSOR  
 
 SET @Cursor = CURSOR  LOCAL STATIC FORWARD_ONLY READ_ONLY 
 FOR  
  SELECT TOP(@Count) TransactionNumber  
    from dbo.CustomerShippingInfo WITH(NOLOCK)  
  WHERE AddressType IS NULL 
  
 OPEN @Cursor 
 FETCH NEXT from @Cursor INTO @TransactionNumber 
 WHILE (@@FETCH_STATUS = 0) 
  BEGIN          
   UPDATE dbo.CustomerShippingInfo 
   SET AddressType = 1 
   WHERE TransactionNumber = @TransactionNumber 
 
   FETCH NEXT from @Cursor INTO @Tran ......
×ܼǼÊý:4346; ×ÜÒ³Êý:725; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [695] [696] [697] [698] 699 [700] [701] [702] [703] [704]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ