dz̸SQL ServerÊý¾Ý¿â²¢·¢²âÊÔ·½·¨
1. ÀûÓòâÊÔ¹¤¾ßÄ£Äâ¶à¸ö×îÖÕÓû§½øÐв¢·¢²âÊÔ; ÕâÖÖ²âÊÔ·½·¨µÄȱµã£º×îÖÕÓû§ÍùÍù²¢²»ÊÇÖ±½ÓÁ¬½Óµ½Êý¾Ý¿âÉÏ£¬¶øÊÇÒª¾¹ýÒ»¸öºÍ¶à¸öÖмä·þÎñ³ÌÐò£¬ËùÒÔ²¢²»Äܱ£Ö¤·ÃÎÊÊý¾Ý¿âʱ»¹ÊDz¢·¢¡£Æä´Î£¬ÕâÖÖ²âÊÔ·½·¨ÐèÒªµÈµ½¿Í»§¶Ë³ÌÐò¡¢·þÎñ¶Ë³ÌÐòÈ«²¿Íê³É²ÅÄܽøÐÐ; 2. ÀûÓòâÊÔ¹¤¾ß±àд½Å±¾£¬Ö±½ÓÁ¬½ÓÊý¾Ý¿â½øÐв¢·¢²âÊÔ; ÕâÖÖ·½·¨¿ÉÒÔÓÐЧµÄ±£Ö¤²¢·¢²Ù×÷£¬¶øÇÒÔÚÊý¾Ý¿â·ÃÎʳÌÐòÍê³É¼´¿É²âÊÔ£¬¿ÉÒÔ´ó
1. ÀûÓòâÊÔ¹¤¾ßÄ£Äâ¶à¸ö×îÖÕÓû§½øÐв¢·¢²âÊÔ;
ÕâÖÖ²âÊÔ·½·¨µÄȱµã£º×îÖÕÓû§ÍùÍù²¢²»ÊÇÖ±½ÓÁ¬½Óµ½Êý¾Ý¿âÉÏ£¬¶øÊÇÒª¾¹ýÒ»¸öºÍ¶à¸öÖмä·þÎñ³ÌÐò£¬ËùÒÔ²¢²»Äܱ£Ö¤·ÃÎÊÊý¾Ý¿âʱ»¹ÊDz¢·¢¡£Æä´Î£¬ÕâÖÖ²âÊÔ·½·¨ÐèÒªµÈµ½¿Í»§¶Ë³ÌÐò¡¢·þÎñ¶Ë³ÌÐòÈ«²¿Íê³É²ÅÄܽøÐÐ;
2. ÀûÓòâÊÔ¹¤¾ß±àд½Å±¾£¬Ö±½ÓÁ¬½ÓÊý¾Ý¿â½øÐв¢·¢²âÊÔ;
ÕâÖÖ·½·¨¿ÉÒÔÓÐЧµÄ±£Ö¤²¢·¢²Ù×÷£¬¶øÇÒÔÚÊý¾Ý¿â·ÃÎʳÌÐòÍê³É¼´¿É²âÊÔ£¬¿ÉÒÔ´ó´óËõ¶Ì²âÊÔʱ¼ä£¬¶øÇÒ²âÊÔЧ¹û¸üºÃ¡£
ÏÂÃæͨ¹ýÒ»¸öÑÝʾ³ÌÐò£¬ÑÝʾʹÓÃRobotʹÓõڶþÖÖ²âÊÔ·½·¨½øÐÐÊý¾Ý¿âµÄ²¢·¢²âÊÔ¡£
µÚÒ»²½£º´´½¨ÑÝʾ³ÌÐò
´ò¿ªSQL SERVER²éѯ·ÖÎöÆ÷£¬ÔÚSQL SERVER²âÊÔÊý¾Ý¿âÖÐÖ´ÐÐÏÂÁнű¾(½Å±¾Ö´ÐвÙ×÷£º´´½¨±ítesttable£¬²¢²åÈëÒ»Ìõ¼Ç¼;´´½¨´æ´¢¹ý³Ìtest)£º¡¡
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Test]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[Test]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[testtable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[testtable]
GO
CREATE TABLE [dbo].[testtable] (
[testid] [int] NULL ,
[counts] [int] NULL
) ON [PRIMARY]
GO
insert into testtable (testid,counts) values (1,0)
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE Procedure dbo.Test
as
declare @count int
begin tran TEST
select @count=countsfrom testtable where testid=1
update testtable setcounts=@count+1
if (@@error >0) begin
rollback tran TEST
end else begin
commit tran TEST
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
µÚ¶þ²½£º´´½¨²âÊԽű¾
ÔÚRobotÖÐн¨VU½Å±¾£¬ÊäÈëÒÔÏÂÄÚÈÝ£º
¡¡#include
{
push Timeout_scale = 200; /* Set timeouts to 200% of maximum response time */
push
Ïà¹ØÎĵµ£º
1.Ò»µÀSQLÓï¾äÃæÊÔÌ⣬¹ØÓÚgroup by
±íÄÚÈÝ£º
2005-05-09 ʤ
2005-05-09 ʤ
2005-05-09 ¸º
2005-05-09 ¸º
2005-05-10 ʤ
2005-05-10 ¸º
2005-05-10 ¸º
Èç¹ûÒªÉú³ÉÏÂÁнá¹û, ¸ÃÈçºÎдsqlÓï¾ä?
ʤ ¸º
2005-05-09 2 2
2005-05-10 1 2
------------------------------- ......
TOM´óÊåµÄµ÷ÓÅÊéÖÐ˵¹ýÒ»¾ä»°£¬¾ßÌåÓ¢ÎľÍÍüÁË£¬´ó¸ÅÒâ˼¾ÍÊÇ£ºÈç¹ûÓÐÈËÈÃÎÒд±¾ÔõÑùÈÃORACLEÐÔÄÜ×îÂýµÄÊéµÄ»°ÎһὫȡÏû°ó¶¨±äÁ¿(bind variable)×öΪÊéµÄµÚÒ»ÕºÍ×îºóÒ»ÕÂ(ËûµÄÒâ˼ÊÇËûºÜÓÐÓÄĬ~~!)£¬¿É¼û°ó¶¨±äÁ¿µÄÖØÒªÐÔ¡£
°ó¶¨±äÁ¿´ó¶àÓÃÔÚOLTP(online transaction process)ÖУ¬ÔÚOLAP(online analizy process)ÖоÍû± ......
1¡¢²é¿´±í¿Õ¼äµÄÃû³Æ¼°´óС
¡¡¡¡select t.tablespace_name, round(sum(bytes/(1024*1024)),0) ts_size
¡¡¡¡from dba_tablespaces t, dba_data_files d
¡¡¡¡where t.tablespace_name = d.tablespace_name
¡¡¡¡group by t.tablespace_name;
¡¡¡¡
¡¡¡¡2¡¢²é¿´±í¿Õ¼äÎïÀíÎļþµÄÃû³Æ¼°´óС
¡¡¡¡select tablespace_ ......
1¡£select * from a where a.rowid=(select min(b.rowid) from b where a.id=b.id);
create test1(
nflowid number primary key,
ndocid number,
drecvdate date);
insert into test1 values (1, 12301, sysdate) ;
insert into test1 values (2, 12301, sysdate);
select * from test1 order by drecvdate:
......
CLR Óû§¶¨Ò庯ÊýÖ»ÊÇÔÚ .NET ³ÌÐò¼¯Öж¨ÒåµÄ¾²Ì¬·½·¨¡£CREATE FUNCTION Óï¾äÒÑÀ©Õ¹ÎªÖ§³Ö´´½¨ CLR
Óû§¶¨Ò庯Êý¡£
1¡¢´´½¨Êý¾Ý¿âÏîÄ¿
¡¡¡¡
2¡¢Ìí¼ÓÓû§¶¨Ò庯Êý
¡¡¡¡
ÒÔÏÂÊÇÑÝʾ´úÂ룺
Code
using
System;
using
System.Data;
using
System.Data.SqlClient;
using
System.Data.Sql ......