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

sqlÅжϺ¯Êý???

¹¦ÄÜ£ºÐ¡Ð´½ð¶îת»»³É´óд
²ÎÊý£º@LowerMoney Сд½ð¶î ¼ÓÉÏСÊýµã×¿ÉÒÔ±£Áô38λ
Êä³ö£º´óд½ð¶î
¼ò½é£ºSQL°æ Сд½ð¶îת»»³É´óд½ð¶î£¨×î¶à¿ÉÒÔ¾«È·µ½Ð¡ÊýµãËÄ룩
×¢£º      Decimal Êý¾ÝÀàÐÍ×î¶à¿É´æ´¢ 38 ¸öÊý×Ö
תÔØ£ºÇë±£ÁôÒÔÉÏÐÅÏ¢,лл£¡£¡£¡
********************************************************/
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
Create Function LowerToUpper(@LowerMoney Decimal(38,4))
Returns Varchar(200)     --·µ»ØµÄ´óд½ð¶îµÄ×Ö·û
As
Begin
       Declare @LowerStr   Varchar(50)    --Сд½ð¶î
       Declare @UpperStr   Varchar(200)   --´óд½ð¶î
       Declare @UpperTmp   Varchar(15)    --´óд½ð¶îµÄÁÙʱ×Ö·û´®
       Declare @i          Int            --µÝÔöÁ¿
       Declare @LowerLen   Int            --Сд½ð¶îµÄ×ܳ¤¶È
       Set @LowerStr = @LowerMoney --°ÑDecimalÐ͵Äֵȫ²¿¸³¸ø×Ö·û´®±äÁ¿ ×¢:(¸³Öµ¹ýÈ¥µÄ»°Èç8 ÔÚ×Ö·û´®±äÁ¿ÖÐÊÇÏÔʾ8.0000 ÒòΪСÊýλ¾«È·µ½ËÄλ,ûÓеĻ°£¬Ëü»á×Ô¶¯²¹0)
       Set @LowerStr = Replace(@LowerStr,'.','') --°ÑСÊýµãÌæ»»³É¿Õ×Ö·û      --¾«È·µ½Ð¡ÊýµãµÄËÄλ ½Ç·ÖÀåºÁ
       Set @LowerLen = Len(@LowerStr) --»ñȡСд½ð¶îµÄ×ܳ¤¶È(°üÀ¨ËĸöСÊýλ)
       Select @i = 1,@UpperStr = '',@UpperTmp = '' --ÉèÖÃĬÈϳõʼֵ
       While @i <= @LowerLen         
          Begin
          &n


Ïà¹ØÎĵµ£º

SQL·ÖÒ³¼¼Êõ

±¾ÎÄÀ´×Ô£ºhttp://niunan.javaeye.com/blog/264197
±È½ÏÍòÄܵķÖÒ³£º
select top Ã¿Ò³ÏÔʾµÄ¼Ç¼Êý * from topic where id not in  
(select top £¨µ±Ç°µÄÒ³Êý-1£©×ÿҳÏÔʾµÄ¼Ç¼Êý id from topic order by id& ......

ÊéдSQLʱҲ»ñµÃÖÇÄÜÌáʾ

дSQLµÄ±Èд.NET³ÌÐòµÄÌåÑéÉϲîÒ»µÈ£¬Ã»ÓÐÖÇÄÜÌáʾ£¬ÐèÒª¼Çס¹Ø¼ü×Ö£¬º¯Êý»òÕß²»¶ÏµØCopy±í×Ö¶ÎÃû£¬×Ô¶¨Ò庯Êý£¬´æ´¢¹ý³ÌÖ®ÀàµÄ¡£²»¹ýÔÚVS2010ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃÖÇÄÜÌáʾÁË£¬ÈçÏÂÃ漸·ùͼËùʾ£º Ôڱ༭Æ÷ÖУ¬ ÊäÈë Shift + J £¨Ìáʾ£º VS2010 ¿ª·¢¹¤¾ßÖбêµÄÊÇ Ctrl +J ÆäʵӦ¸ÃÊÇ Shift + J £©¾Í¿ÉÒÔ×Ô¶¯´ò¿ªÕâ¸öÖÇÄÜÌá ......

SQLËø±íÓï¾ä(ת)

Ëø¶¨Êý¾Ý¿âµÄÒ»¸ö±í
SELECT * from table WITH (HOLDLOCK)
×¢Òâ: Ëø¶¨Êý¾Ý¿âµÄÒ»¸ö±íµÄÇø±ð
SELECT * from table WITH (HOLDLOCK)
ÆäËûÊÂÎñ¿ÉÒÔ¶ÁÈ¡±í£¬µ«²»ÄܸüÐÂɾ³ý
SELECT * from table WITH (TABLOCKX)
ÆäËûÊÂÎñ²»ÄܶÁÈ¡±í,¸üкÍɾ³ý
SELECT Óï¾äÖГ¼ÓËøÑ¡ÏŦÄÜ˵Ã÷
SQL ServerÌṩÁËÇ¿´ó¶øÍ ......

sql»ù´¡

Student(S#,Sname,Sage,Ssex) ѧÉú±í
Course(C#,Cname,T#) ¿Î³Ì±í
SC(S#,C#,score) ³É¼¨±í
Teacher(T#,Tname) ½Ìʦ±í
ÎÊÌ⣺
1¡¢²éѯ“001”¿Î³Ì±È“002”¿Î³Ì³É¼¨¸ßµÄËùÓÐѧÉúµÄѧºÅ£»
  select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
  fr ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ