Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÉîÈëÑо¿SQL SERVER 2005ºÍ¶à»î¶¯½á¹û¼¯£¨MARS£©

SQL SERVER 2005ÒýÈëÁËÔÚµ¥Ò»Á¬½ÓÉ϶Զà»î¶¯½á¹û¼¯£¨Ò²³ÆÎªMARS£©»ò¶à¸öÇëÇóµÄÖ§³Ö¡£Í¨¹ýÔÚÓëSQL SERVER 2005µÄÁ¬½ÓÉÏÆôÓÃÕâÒ»ÌØÐÔ£¬µ±´æÔÚÓëSqlconnectionÏà¹ØÁªµÄ¿ª·ÅʽSqlDataReaderʱ£¬Á¬½Ó½«²»»áÖжϡ£¼´Ê¹ÉÐδ¹Ø±Õµ±Ç°´ò¿ªµÄSqlDataReader£¬Ò²ÈÔÈ»Äܹ»ÔÚSqlconnectionÉÏÖ´ÐÐÆäËû²éѯ±ÈÈ磺SELECT£¬UPDATE£¬CREATETABLEµÈµÈ¡£
¾Ù¸ö¼òµ¥µÄÀý×Ó£¬¾ÍÊÇÔÚNorthwindÊý¾Ý¿âÀïµÄ¶©µ¥±íÀïÈ¡¶©µ¥Êý¾Ý£¬¶øÇҰѶÔÓ¦µÄ×Ó¶©µ¥Ã÷ϸÊý¾ÝÒ»ÆðÈ¡³ö¡£
C#ʾÀý´úÂ룺<¼¤¹â´«Õæ»ú>
string strSQL;
SqlConnectionStringBuilder ssb = new SqlConnectionStringBuilder();
ssb.DataSource = ".";
ssb.InitialCatalog = "Northwind";
ssb.UserID = "sa";
ssb.Password = "********";
ssb.MultipleActiveResultSets = true;
SqlConnection cn = new SqlConnection(ssb.ConnectionString);
SqlCommand cmdOrders, cmdDetials;
SqlParameter pCustID, pOrderID;
SqlDataReader rdrOrders, rdrDetials;
cn.Open();
strSQL = "SELECT OrderID,OrderDate from Orders WHERE CustomerID = @CustomerID";
cmdOrders = new SqlCommand(strSQL, cn);
pCustID = cmdOrders.Parameters.Add("@CustomerID", SqlDbType.NChar, 5);
strSQL = "SELECT ProductID,Quantity,UnitPrice from [ORDER dETAiLS] WHERE OrderID = @OrderID";
cmdDetials = new SqlCommand(strSQL, cn);
pOrderID = cmdDetials.Parameters.Add("@OrderID", SqlDbType.NChar, 5);
pCustID.Value = "ALFKI";
Console.WriteLine("Orders for {0}", pCustID.Value);
Console.WriteLine("=================");
rdrOrders = cmdOrders.ExecuteReader();
while (rdrOrders.Read())
{
Console.WriteLine("OrderID: {0} OrderDate:{1:d}", rdrOrders["OrderID"], rdrOrders["OrderDate"]);
pOrderID.Value = rdrOrders["OrderID"];
rdrDetials = cmdDetials.ExecuteReader();
while (rdrDetials.Read())


Ïà¹ØÎĵµ£º

sql 2005 ´æ´¢¹ý³Ì·ÖÒ³ java ´úÂë

 create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',         
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ ......

SQL Server ÈÕÆÚ²Ù×÷È«½Ó´¥

DECLARE @dt datetime
SET @dt=GETDATE()
DECLARE @number int
SET @number=3
--1£®Ö¸¶¨ÈÕÆÚ¸ÃÄêµÄµÚÒ»Ìì»ò×îºóÒ»Ìì
--A. ÄêµÄµÚÒ»Ìì
SELECT CONVERT(char(5),@dt,120)+'1-1'
--B. ÄêµÄ×îºóÒ»Ìì
SELECT CONVERT(char(5),@dt,120)+'12-31'
--2£®Ö¸¶¨ÈÕÆÚËùÔÚ¼¾¶ÈµÄµÚÒ»Ìì»ò×îºóÒ»Ìì
--A. ¼¾¶ÈµÄµÚÒ»Ìì
SELECT CON ......

MySQL¶Ô±ê×¼SQLµÄÀ©Õ¹

MySQL·þÎñÆ÷°üº¬Ò»Ð©ÆäËûSQL DBMSÖв»¾ß±¸µÄÀ©Õ¹¡£×¢Ò⣬Èç¹ûʹÓÃÁËËüÃÇ£¬½«ÎÞ·¨°Ñ´úÂëÒÆÖ²µ½ÆäËûSQL·þÎñÆ÷¡£ÔÚijЩÇé¿öÏ£¬Äã¿ÉÒÔ±àд°üº¬MySQLÀ©Õ¹µÄ´úÂ룬µ«ÈÔ±£³ÖÆä¿ÉÒÆÖ²ÐÔ£¬·½·¨ÊÇÓÓ/*... */”×¢Ê͵ôÕâЩÀ©Õ¹¡£MySQL·þÎñÆ÷Äܹ»½âÎö²¢Ö´ÐÐ×¢ÊÍÖеĴúÂ룬¾ÍÏñ¶Ô´ýÆäËûMySQLÓï¾äÒ»Ñù£¬µ«ÆäËûSQL·þÎñÆ÷½«ºöÂÔ ......

¼¸ÌõÓÐÓõÄSqlÓï¾ä

1. Sql  ÑÓʱºòÖ´ÐÐ
a. ÈýÊ®ÃëºóÖ´ÐÐ WAITFOR DELAY  ºóÃæµÄÓï¾ä
WAITFOR DELAY '00:00:30'
b. 10:00·Ö¿ªÊ¼Ö´ÐкóÃæµÄ´úÂë
WAITFOR TIME '10:00';
 
2.  ÊÕËõÊý¾Ý¿â£¬Ê¹Æä¿ÕÓà¿Õ¼äΪ0%
DBCC SHRINKDATABASE (DataBaseName,0)
3.  È¡µÃÊý¾Ý¿âÎļþËùÔÚµÄÅÌ·û
declare @dirverNam ......

SQLÏÂÈÕÆÚº¯ÊýʹÓÃ

ÕâÁ½Ììдһ¸öºÍͳ¼ÆÊý¾ÝÓйصĴ洢¹ý³Ì£¬ÀïÃæÒªÀûÓÃÈÕÆÚ½øÐÐһЩ¼ÆËãºÍÅжϣ¬Ò²×ÔȻҪÀûÓÃSQLµÄһЩÈÕÆÚÏà¹ØµÄº¯Êý¡£ÕâÀïÂÔ¼Çһϣ¬µ±ÊǸ´Ï°Ò»ÏÂSQL¡£
ÀûÓÃSQL½Å±¾ÄÚÖõöº¯Êý£¬ÎÒÃÇÄÜÁé»îµÄ¶ÔÈÕÆÚ½øÐмÆËãºÍ±È½Ï¡£³£Óõöº¯Êý£ºGETDATE(),DATEDIFF(),DATEADD()
GETDATE() µ±È»¹ËÃû˼Ò壬µÃµ½µ±Ç°µÄÈÕÆÚ£¬·µ»ØÀàÐÍÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ