SQL SERVER¶àÁÐÈ¡×î´ó»òÕß×îСֵ
/*
lvl1 lvl2 lvl3 lvl4 lvl
4 3 4 1
3 2 2 1
2 2 3 4
4 4 3 4
3 1 2 2
Ôõôд´úÂë È¥±È½Ïlvl1¡¢lvl2¡¢lvl3¡¢lvl4 ¶ÔӦÿÐеÄÖµ£¬È¡ÆäÖÐ×îСµÄ£¬½«ÆäÖµÌí¼Óµ½lvlÁÐÀï
ÔËÐнá¹ûÓ¦¸ÃÊÇ
lvl
1
1
2
3
1
*/
--·½·¨(Ò») º¯數·¨
-->Title:Generating test data
-->Author:wufeng4552
-->Date :2009-10-16 09:58:16
if not object_id('Tempdb..#t') is null
drop table #t
Go
Create table #t([lvl1] int,[lvl2] int,[lvl3] int,[lvl4] int,[lvl] int)
Insert #t
select 4,3,4,1,null union all
select 3,2,2,1,null union all
select 2,2,3,4,null union all
select 4,4,3,4,null union all
select 3,1,2,2,null
Go
if object_id('UF_minget')is not null drop function UF_minget
go
create function UF_minget
(@col1 int,@col2 int,@col3 int,@col4 int)
returns int
as
begin
declare @t table(col int)
insert @t select @col1 union all
select @col2 union all
select @col3 union all
select @col4
return(select min(col)from @t)
end
go
update t set [lvl]=dbo.UF_minget([lvl1],[lvl2],[lvl3],[lvl4])
from #t t
select * from #t
/*
lvl1 &
Ïà¹ØÎĵµ£º
Sql´úÂë
--²ÉÓÃSQLÓï¾äʵÏÖsql2005ºÍExcel Êý¾ÝÖ®¼äµÄÊý¾Ýµ¼Èëµ¼³ö£¬ÔÚÍøÉÏÕÒÀ´Ò»--Ï£¬ÊµÏÖ·½·¨ÊÇÕâÑùµÄ£º
--Excel---->SQL2005 µ¼È룺
select * into useinfo from O ......
°üÀ¨°²×°Ê±ÌáʾÓйÒÆðµÄ²Ù×÷¡¢ÊÕËõÊý¾Ý¿â¡¢Ñ¹ËõÊý¾Ý¿â¡¢×ªÒÆÊý¾Ý¿â¸øÐÂÓû§ÒÔÒÑ´æÔÚÓû§È¨ÏÞ¡¢¼ì²é±¸·Ý¼¯¡¢ÐÞ¸´Êý¾Ý¿âµÈ¡£
¡¡¡¡(Ò»)¹ÒÆð²Ù×÷
¡¡¡¡ÔÚ°²×°Sql»òsp²¹¶¡µÄʱºòϵͳÌáʾ֮ǰÓйÒÆðµÄ°²×°²Ù×÷£¬ÒªÇóÖØÆô£¬ÕâÀïÍùÍùÖØÆôÎÞÓ㬽â¾ö°ì·¨£º
¡¡¡¡µ½HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Man ......
£¨http://www.builder.com.cn/2008/0211/733054.shtml£© »ù´¡ÖªÊ¶£¨4£©
²»ÂÛÊÇ ¾Û¼¯Ë÷Òý£¬»¹ÊǷǾۼ¯Ë÷Òý£¬¶¼ÊÇÓÃB+Ê÷À´ÊµÏֵġ£ÎÒÃÇÔÚÁ˽âÕâÁ½ÖÖË÷Òý֮ǰ£¬ÐèÒªÏÈÁ˽âB+ͨ¹ý×ܽᣬÎÒ·¢ÏÖ×Ô¼ºÒÔÇ°ºÜ¶àºÜÄ£ºýµÄ¸ÅÄÇåÎúÁ˺ܶࡣ
²»ÂÛÊÇ ¾Û¼¯Ë÷Òý£¬»¹ÊǷǾۼ¯Ë÷Òý£¬¶¼ÊÇÓÃB+Ê÷À´ÊµÏֵġ£ÎÒÃÇÔÚÁ˽âÕâÁ½ÖÖË÷Òý֮ǰ£¬ÐèÒªÏÈ ......
ÓÃOracleµÄtkprof·ÖÎöSQLÖ´ÐÐЧÂÊ
1¡¢´ò¿ª¸ú×Ù
SQL> alter session set sql_trace=true;
2¡¢Ö´ÐÐSQL
SQL> select count(*) from xxxx;
3¡¢¹Ø±Õ¸ú×Ù
SQL> alter session set sql_trace=false
4¡¢ÕÒµ½trcÎļþ
Ä¿±êÎļþĿ¼ÔÚ£º
SQL> select value from v$parameter where
name='user_dump_dest';
5¡¢± ......
Oracle ϵÁУº PL/SQL±í
Ò»£¬Ê²Ã´ÊÇPL/SQL±í£¿
Ê×ÏÈPL/SQL±íºÍ¼Ç¼(Record)Ò»Ñù£¬¶¼ÊǸ´ºÏÊý¾ÝÀàÐÍ¡£¿ÉÒÔ¿´×öÊÇÒ»ÖÖÓû§×Ô¶¨ÒåÊý¾ÝÀàÐÍ¡£
PL/SQL±íÓɶàÁе¥ÐеıêÁ¿¹¹³ÉµÄÁÙʱË÷Òý±í¶ÔÏó¡£×é³ÉÀàËÆÓÚһάÊý×é¡£
Çø±ðºÍÁªÏµ¼Ç¼(Record)µÄµ¥ÐжàÁкÍÎïÀí´æ´¢Êý¾ÝµÄ±í¡£
Record + PL/SQL± ......