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

sql ²éѯ³öÀ´Ò»¸ö±íÔÚ²åÈëµ½ÁíÒ»¸ö±íÀï

ALTER  FUNCTION  [dbo].[fun_tongji]()
RETURNS  @t1 table (
  yue int ,
  money int
 )
AS
begin
 Declare @i int
 set @i=1
-- declare @t1 table (
--  yue int ,
--  money int
-- )
 while (@i<=12)     
 begin        
  INSERT into @t1 (yue,money) select isnull(sum(money),0) as money,@i as yue from zhangbenjilu where datepart(month,usedatetime)=@i
  set @i=@i+1
 end
 return ;
end


Ïà¹ØÎĵµ£º

SQLÖ®¾Å Êý¾Ý¿âÉè¼Æ

Íâ¼ü
======================
Íâ¼üÊÇÏà¶ÔÓÚÖ÷¼ü˵µÄ£¬Êǽ¨Á¢±íÖ®¼ä µÄÁªÏµµÄ±ØÐëµÄǰÌá¡£
   ±ÈÈ磺ѧÉú±í ¡¢Ñ§Éú³É¼¨±íÒ»Ò»¶ÔÓ¦ÊÇÒòΪ ËûÃǶ¼¾ßÓÐÏàͬµÄ×ֶΣºÑ§ºÅ£¬°ÑѧÉú±í×÷ΪÖ÷±í£¬Ñ§ºÅÊÇËûµÄÖ÷¼ü£¬Ïà¶ÔÓÚÖ÷±íÀ´Ëµ£¬Ñ§Éú³É¼¨µÄ×ֶΠѧºÅ¾ÍÊÇѧÉú±íµÄÍâ¼ü¡£
  ûÓÐÍâ¼ü£¬Á½¸ö±í¾Íû°ì·¨½¨Á¢ÁªÏµ°¡£¡ ......

SQL SERVER 2005Êý¾Ý¿â¾µÏñ

ͨ¹ýµÚÆßÆÚºÍµÚ°ËÆÚµÄÎÄÕ£¬ÎÒÃÇÁ˽âÁËSQL SERVER 2005Êý¾Ý¿âµÄÔ­Àí¡¢ÊµÏÖ·½Ê½ÒÔ¼°SQL SERVER 2005Ôڸ߿ÉÓᢸßÐÔÄܺ͸߱£»¤Ä£Ê½Ï»áÓв»Í¬µÄÊý¾Ý¿â¾µÏñ״̬£¬¶øÇÒÁ˽âÁËSQL SERVER 2005ÔÚ²»Í¬Ó¦ÓÃģʽϹÊÕÏ×ªÒÆµÄ·½Ê½¡£½ÓÏÂÀ´£¬ÎÒÃǽ«¸ù¾ÝÒÔÏÂÁ½Ààʼþ¶ÔÊý¾Ý¿â¾µÏñÔ¤ÆÚµÄ¿ÉÓÃÐÔ½øÐзÖÎö£º
Ò»¸ö»ò¶à¸ö·þÎñÆ÷»òÕßÊý¾Ý¿âʧ° ......

SQL 2005 xml ´¦ÀíµÄһЩsample

USE Test
--Create 2 tables as an example
CREATE TABLE ExampleTable
(
[ID] int PRIMARY KEY
,[Name] nvarchar(256)
)
CREATE TABLE ExampleTable2
(
[ID] int PRIMARY KEY
,[Name] nvarchar(256)
)
----way1
SELECT *
from sys.objects [table]
WHERE
[Name] LIKE 'ExampleTable%'
FOR XML AUTO, ROOT ......

DBMS_SQL°üʵÏÖ¶¯Ì¬SQL

.ÔÚ²éѯÖлáÓöµ½ UNION ALL,ËüµÄÓ÷¨ºÍunionÒ»Ñù,Ö»²»¹ýunionº¬ÓÐdistinctµÄ¹¦ÄÜ,Ëü»á°ÑÁ½ÕűíÁËÖØ¸´µÄ¼Ç¼ȥµô,¶øunion all²»»á,ËùÒÔ´ÓЧÂÊÉÏ,union all »á¸ßÒ»µã.
2.union all Êǰ´Ô­ÏÈ˳ÐòÅÅÁеģ¬union °ÑÁ½ÕűíÖеÄÖØ¸´Êý¾ÝÈ¥µôºó»¹½øÐÐÁËÖØÐÂÅÅÐò
ÉùÃ÷£º´ËÎÄÀ´Ô´ÓÚÍøÂ·£¡
ÄÚÈÝÕªÒª£ºÔÚPL/SQL¿ª·¢¹ý³ÌÖУ¬Ê¹ÓÃSQL£¬ ......

SQL Server 2000 ¸÷ÖÖ¶ÔÏóµÄ×î´óÖµ(ÊýÁ¿»ò´óС)

SQL Server 2000 ¸÷ÖÖ¶ÔÏóµÄ×î´óÖµ(ÊýÁ¿»ò´óС)
¹ÜÀíµÄÒ»¸öÊý¾Ý¿â´óС½«½ü10G£¬¿ªÊ¼µ£ÐÄÊý¾Ý¿â»á²»»á¹ý´ó£¬²éѯSQL ServerµÄÁª»ú´ÔÊéºó·¢ÏÖ×Ô¼ºµÄµ£ÐÄÕæµÄÊǶàÓàµÄ¡£
SQL Server 2000Êý¾Ý¿âÎļþ´óС£¨Êý¾Ý¡¢ÈÕÖ¾£©×î´ó¿ÉÒÔÖ§³Ö 32 TB µÄÎļþ
½ØÈ¡SQL Server 2000Áª»ú´ÔÊéÖеÄ×î´óÈÝÁ¿ËµÃ÷·½±ã´ó¼Ò²éÔÄ¡£
SQL ServerÊý¾Ý ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ