-
SQL·ÖÒ³´æ´¢¹ý³Ì,¸ÃÔõô½â¾ö
SQL·ÖÒ³´æ´¢¹ý³ÌsetANSI_NULLSONsetQUOTED_IDENTIFIERONgoALTERPROC[dbo].[P_viewPage_A]/**/@TableNameVARCHAR(200),--±íÃû@FieldListVARCHAR(2000),--ÏÔʾÁÐÃû£¬Èç¹ûÊÇÈ«²¿×Ö¶ÎÔòΪ*@PrimaryKeyVARCHAR(100),--µ¥Ò»Ö÷¼ü»òΨһֵ¼ü@WhereVARCHAR(20...
19
ÈÈ¶È -
´æ´¢¹ý³ÌÒì³£
´æ´¢¹ý³Ì´íÎóSETANSI_NULLSONGOSETQUOTED_IDENTIFIERONGOCREATEPROCEDUREDeleteFromTable @TableNameFromnvarchar(100), @TableNameTonvarchar(100), @LeaveCountintASBEGIN SETNOCOUNTON; DECLARE@TempTypeidint DECLA...
72
ÈÈ¶È -
Ôõô¼ÆËãʱ¼ä ¶àÉÙÌì
ÈçºÎ¼ÆËãʱ¼ä¶àÉÙÌì¼ÙÉèÓÐÒÔϼ¸¸ö¿í´øÀàÐÍʹÓÃʱ¼ä¶Î----------------------------¿ª»§ÀàÐÍ¿ªÊ¼Ê±¼ä½áÊøʱ¼äÀàÐÍ12010-01-012010-10-15ÀàÐÍ22010-10-202010-12-15ÀàÐÍ32010-12-122011-01-01¼ÙÉè½ñÌìÊÇ2011-01-01Çó³öÈçÏÂÐÅÏ¢£º0-30ÌìʹÓÃʱ¼ä£º30ÌìÂ߼˵Ã÷£¨2010Äê12ÔÂ2ÈÕµ½2010Äê12ÔÂ31ÈÕ£©30-...
91
ÈÈ¶È -
SQLÐÐÔõôת»»³ÉÁÐ
SQLÐÐÈçºÎת»»³ÉÁУ¿SQLcodeCREATETABLETABLE1(IDINT,NAMEVARCHAR(50))CREATETABLETABLE2(IDINT,USERNAMEVARCHAR(50))INSERTtable1SELECT1,'kk'UNIONSELECT2,'ll'UNIONSELECT3,'ll'INSERTtable2SELECT1,'lk'UNIONSELECT3,'io...
17
ÈÈ¶È -
½Ó»îÔ¾Æø·ÕÌù£º9*9ÓйØÎÊÌâ
½Ó»îÔ¾Æø·ÕÌù£º9*9ÎÊÌâÔÌû£ºhttp://topic.csdn.net/u/20120526/13/11dbdbd6-c869-4078-8872-427b89ce6f6c.htmlSQLcode--Ç¿´óµÄpivot--Êý¾Ý×¼±¸createtablet4(rowint,colint,valchar(10))--Ìí¼Ó²âÊÔÊý¾Ýdeclare@xintdeclare@yintdeclare@cvarc...
53
ÈÈ¶È -
Ö´Ðд洢¹ý³Ì³öÏÖ½« nvarchar ת»»ÎªÊý¾ÝÀàÐÍ numeric ʱ³öÏÖËãÊõÒç³öÒì³£
Ö´Ðд洢¹ý³Ì³öÏÖ½«nvarcharת»»ÎªÊý¾ÝÀàÐÍnumericʱ³öÏÖËãÊõÒç³ö´íÎó¡£execycliek_update@user=N'admin',@chuangtm=N'customer',@bs=0,@kuangjm=N'dg1',@liem=N'id',@liek=77,@liex=0goÈçÖ´ÐÐÕâ¾ä¾Í»á³ö´í,¸ßÊÖ°ïÎÒ¿´ÏÂÕâ¸ö´æ´¢¹ý³ÌÊDz»ÊÇÄÄÀïдµÄ²»¶Ô,лл´æ´¢¹ý³ÌÈçÏÂALTERPROCEDUR...
421
ÈÈ¶È -
´´½¨Êý¾Ý¿â¿âÒì³£Çó½â
´´½¨Êý¾Ý¿â¿â´íÎóÇó½â£¿usemastergoifexists(select*fromsys.databaseswherename='test') dropdatabasetestcreatedatabaseteston( name='test', filename='E:\test.mdf', size=5mb, filegrowth=10%, maxsize=50mb)logon( name='...
91
ÈÈ¶È -
´æ´¢¹ý³ÌÔö¶à×ֶα¨´í
´æ´¢¹ý³ÌÔö¼Ó×ֶα¨´íSQLcodesetANSI_NULLSONsetQUOTED_IDENTIFIERONgoALTERPROCEDURE[dbo].[zzz_cz_wyh_bom]@Fnumbernvarchar(255)ASdeclare@finteridintdeclare@fitemidintselect@fitemid=fitemidfromt_icitemwhere--fnumber...
25
ÈÈ¶È -
SQL2005 ¶ÓÁÐÞD“Q
SQL2005ÐÐÁÐÞD“QÐÐŒ£ÁЃHÐèÒªformID£¬colname£¬Colvaluecolor='#e78608'>------½â¾ö·½°¸--------------------http://topic.csdn.net/u/20080614/17/22e73f33-f071-46dc-b9bf-321204b1656f.htmlcolor='#e78608'>------½â¾ö·½°¸-----------...
363
ÈÈ¶È -
Ò»¸öSQLËã·¨£¬¶àл´ó¼ÒÁË£¡
Çë½Ì¸ßÊÖÒ»¸öSQLËã·¨£¬Ð»Ð»´ó¼ÒÁË£¡£¡£¡Ò»¸ö¹ØÓÚÕËÁä¼ÆËãµÄÎÊÌ⣬ÏÂÃæÊÇÔ´Êý¾Ý±í¿Í»§ µ¥¾ÝÀàÐÍ Óà¶î µ¥¾ÝÈÕÆÚ ÕËÁäA Ó¦ÊÕ 1292301 2010-1-3100:00 121A Ó¦ÊÕ 1139292 2010-2-2800:00 93A Ó¦ÊÕ 1152316.8 2010-3-2300:00 70A Ó¦ÊÕ 78148.8 2010-3-2300:00 70A Ó¦ÊÕ 1230465.6 2010-...
60
ÈÈ¶È -
ÐÐתÁÐ ±í Ãû³Æ ÀàÐÍ ÈÕÆÚ ±¸×¢ °ÑÀàÐÍת³ÉÁÐ
ÐÐתÁбíÐÕÃûÀàÐÍÈÕÆÚ±¸×¢°ÑÀàÐÍת³ÉÁÐÐÐתÁбíÐÕÃûÀàÐÍÈÕÆÚ±¸×¢°ÑÀàÐÍת³ÉÁÐÈç±íÐÕÃûÀàÐÍÈÕÆÚ±¸×¢acc2012-4-2506:30abcdbdd2012-4-2508:30dddadd2012-4-2607:30aee2012-4-2502:30²éѯºó»áÏÔʾÐÕÃûccddeeÈÕÆÚ±¸×¢color='#e78608'>------½â¾ö·½°¸--------------------SQLcode--ÐÐÁл¥×ª--...
530
ÈÈ¶È -
¶¯Ì¬sql ¶àÌõ¼Ç¼ºÏ²¢³ÉÒ»Ìõ¼Ç¼
ÇóÒ»¸ö¶¯Ì¬sql¶àÌõ¼Ç¼ºÏ²¢³ÉÒ»Ìõ¼Ç¼SQLcodedeclare@fnamenvarchar(20)--×Ö¶ÎÃûdeclare@tbnamenvarchar(20)--±íÃûdeclare@dfinenvarchar(100)--declare@valuenvarchar(20)--×Ö¶ÎÖµdeclare@sqlnvarchar(500)--¶¯Ì¬Óï¾ädeclare@returnsnvarchar(50...
37
ÈÈ¶È -
sql Óï¾äÇóÓÅ»¯,¸ÃÔõô´¦Àí
sqlÓï¾äÇóÓÅ»¯SELECTzdrqÈÕÆÚ,djbhµ¥ºÅ,c.ckbh²Ö¿â±àºÅ,CKMC²Ö¿â,H.CFE1Ìá»õ·½Ê½,H.CFE2¸¶¿î·½Ê½,(selecttop1djbhfromk_ckwcwleftjoink_ckctoncw.link=ct.linkwherecw.fhid=w.id)³ö¿âµ¥ºÅ,k.khbh¿Í»§±àºÅ,K.KHMCAS¿Í»§Ãû³Æ,y.ywbhÒµÎñ±àºÅ,Y.YWXMASÒµÎñÔ±,W.SPB...
40
ÈÈ¶È -
ÇóÏêϸ½âÊÍ¡£½â¾ö˼·
ÇóÏêϸ½âÊÍ¡£SQLcodeCREATEPROCEDURE[dbo].[Dv_GetRecordFromPage]@tableNamenvarchar(100),--±íÃû@fldSortnvarchar(100)='dateandtime',--ÅÅÐò×Ö¶Î@pageSizeint=30,--ÿҳ´óС@pageint=1,--µÚ¼¸Ò³@Sortbit=1,--ÅÅÐò,@Sort=0[email p...
59
ÈÈ¶È -
Çó»ã×ÜSQL,¸ÃÈçºÎ´¦Àí
Çó»ã×ÜSQLÔÊý¾Ý±íÈçÏ£ºÐÕÃû ÓïÎÄ Êýѧ Ó¢ÓïÕÅÈý A ÕÅÈý A ÕÅÈý BÀîËÄ B ÀîËÄ C ÀîËÄ AÈçºÎµÃµ½ÒÔϲéѯ½á¹û£¿ÐÕÃû ÓïÎÄ Êýѧ Ó¢ÓïÕÅÈý A A BÀîËÄ B C Acolor='#e78608'>------½â¾ö·½°¸--------------------SQLcode--ÐÐÁл¥×ª--1¡¢Ðл»ÁÐifobject_id('Class')isnotnulldroptab...
63
ÈÈ¶È -
¼±Çósql ·Ç³£¸Ðл½â¾ö·½°¸
¼±Çósql·Ç³£¸Ðл797EA420-E9E0-428A-A8B4-35B3B11BC838 ÉϺ£×é 1 1 1 1 198F591F8-7C58-4611-92ED-8663E61832F8 ÉϺ£×é 1 1 1 1 1B4745602-02AD-4CB5-8194-9A1DC1CAA4F4 ÉϺ£×é 1 0 1 0 197A59D8D-1C5D-4303-8192-9B76CB442F8E ÉϺ£×é ...
45
ÈÈ¶È -
sqlÓÎÏ· + - * /£¨²âÊ԰棩½â¾ö·½°¸
sqlÓÎÏ·+-*/£¨²âÊ԰棩³é¿ÕдÍêÀ²~дÍêºó·¢ÏÖÓÃÁ˺öà֪ʶµã~²»ÈÝÒ×°¡~~»¹Ð´Á˸öºÜºÃÓõĺ¯Êý~~Âé·³´ó¼Ò²â²â~~CREATEFUNCTIONf_ww(@varvarchar(50),@vsvarchar(50))RETURNSchar(1)ASbegin iflen(@var)<>len(@vs) RETURN'F' declare@strvarchar(50)...
90
ÈÈ¶È -
´¥·¢Æ÷ÒÉÄÑÓйØÎÊÌ⣬Õæ·³ÐÄ
´¥·¢Æ÷ÒÉÄÑÎÊÌ⣬Õæ·³ÐÄSQLcodeCREATETRIGGERupdate_stockONdbo.tbl_test_orderFORinsertASdeclare@order_numintdeclare@ordernovarchar(50)declare@product_novarchar(50)declare@colorvarchar(50)declare@product_sizevarchar...
35
ÈÈ¶È -
ÐÐÁл¥×ª_ÕûÀíÌù3,¸ÃÈçºÎ½â¾ö
ÐÐÁл¥×ª_ÕûÀíÌù3SQLcode--ÐÐÁл¥×ª/******************************************************************************************************************************************************ÒÔѧÉú³É¼¨ÎªÀý×Ó£¬±È½ÏÐÎÏóÒ׶®ÕûÀíÈË£ºÖйú·ç(Roy)...
57
ÈÈ¶È -
°ïСµÜÎÒ¿´¿´Õâ¸ö´æ´¢¹ý³ÌÓÐʲôÓйØÎÊÌâ
°ïÎÒ¿´¿´Õâ¸ö´æ´¢¹ý³ÌÓÐʲôÎÊÌ⣿CREATEPROCEDURE[dbo].[spMRViewToProc]@FromDbNamevarchar(50),@ToDbNamevarchar(50)ASexec('SELECT'[email protected]/**/+'.dbo.materialrequest.*,ISNULL('[email pr...
44
ÈȶÈ