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

SQLÊý¾Ý¿â±í»µÁ˵ÄÊÖ¶¯»Ö¸´·½·¨

      ½ñÌì½Óµ½¿Í»§µç»°£¬Ëµ²Ù×÷Êý¾ÝÎÞ·¨±£´æ¡£¾­¹ý·ÖÎö£¬·¢ÏÖËûµÄÊý¾Ý¿âÒѾ­ÓÐ5G¶àµÄ´óС£¬¶ø×îÖÕ·¢ÏÖÓÐÕűíµÄË÷Òý³ö´íÁË£¬ÓÃDBCC CHECKÒ²ÎÞÁ¦»ØÌì¡£
ÿ´ÎÓÃselect * from ln003082 Óï¾ä²éѯ£¬¶¼±¨ÈçÏ´íÎó£º
·þÎñÆ÷: ÏûÏ¢ 605£¬¼¶±ð 21£¬×´Ì¬ 1£¬ÐÐ 1
ÊÔͼ´ÓÊý¾Ý¿â 'ln_fl0125' ÖÐÌáÈ¡µÄÂß¼­Ò³ (1:629904) ÊôÓÚ¶ÔÏó '869578136'£¬¶ø·Ç¶ÔÏó 'LN003082'¡£
Á¬½ÓÖжÏ
û°ì·¨£¬Ö»ÄÜÏë°ì·¨»Ö¸´ÁË¡£»¹ºÃÓм¸Î»ÀÏÊÖÔÚÉí±ß¡£ÓÚÊÇͨÈçÒÔϲ½ÖèÃãÇ¿»Ö¸´ÓÐЧÊý¾Ý£¬µ±È»£¬Óв¿·Ýµ¥×ÓÊý¾ÝÊǶªÊ§ÁË¡£Ö»Äܽпͻ§ÔÙÈ¥²¹ÁË¡£
 Ê×ÏÈҪȷ¶¨ÄÄЩÊý¾Ý»Ø²»À´ÁË£¬Í¨¹ýÓαêÀ´Ò»Ò»È·¶¨ÄÄЩÊý¾ÝÎÞЧÁË¡£
declare @bill_no varchar(20)
declare @shop_no varchar(20)
DECLARE  @QTY INT
DECLARE terminal_changecursor CURSOR FOR
   select bill_no,shop_no from terminal_change
   group by shop_no,bill_no
   ORDER by shop_no,bill_no
OPEN terminal_changecursor
FETCH NEXT from terminal_changecursor into  @bill_no ,@shop_no
WHILE @@FETCH_STATUS = 0
BEGIN
 FETCH NEXT from terminal_changecursor into  @bill_no ,@shop_no
 PRINT  @bill_no +'-'+@shop_no
 IF  NOT (
(@bill_no='MB10010033' AND @shop_no = 'P9ZT') OR  
(@bill_no='MT90910001' AND @shop_no = 'P9ZT') OR
(@bill_no='MT00110002' AND @shop_no = 'P10D') OR
(@bill_no='MB10010034' AND @shop_no = 'P9ZT') OR
(@bill_no='MB10010035' AND @shop_no = 'P9ZT') 
 
)
 select @QTY=sum(bill_qty) from LN003082 WHERE   bill_no=@bill_no AND  shop_no=@shop_no
ENDEND
DEALLOCATE terminal_changecursor
GO
ͨ¹ýÉÏÃæµÄÓï¾ä£¬¿ÉÒԲ鵽ÄÄЩµ¥ºÅµÄÊý¾Ý³öÁËÎÊÌâ¡£ÓÃIFÌø¹ýÓÐÎÊÌâµÄÊý¾Ý£¬µ±select sumͨ¹ýÓαê²éѯʱ£¬Èç¹ûÓÐÎÊÌâµÄÊý¾Ý£¬¾Í»áÍ£ÏÂÀ´Öжϣ¬¸ù¾Ýprint³öÀ´µÄµ¥ºÅ£¬½«Æä¼ÓÈëÏ´ÎIFÖУ¬Õâ¸ö²½ÖèºÜ¿ÝÔï¡£²»¹ýÒ»°ã²»»á³öÏÖ¹ý¶à¶ªÊ§µÄÊý¾Ý£¬Ò²Ö»ÄÜÕâÑùһһȷ¶¨ÁË¡£
½ÓÏÂÀ´¾ÍÊǸù¾Ý²éѯ³öÀ´ÓÐÎÊÌâµÄÊý¾Ý£¬½øÐйýÂ˻ָ´ÁË¡£
»Ö¸´·½·¨½Å±¾ÈçÏ£º
Ö÷ÒªÓÐ3²½¡£
--˵Ã÷£ºÖն˱䶯Êý¾Ý±í»µÁË£¬¶ªÊ§ÎåÕÅÊý¾Ý£¬Çë֪ͨÖØ´«
--1¡£Öؽ¨±íLN003082ΪLN003082_new,ÓÃÓÚתÒÆÓÐЧÊý¾Ý
select * into LN003082_ne


Ïà¹ØÎĵµ£º

Excel±íÊý¾Ýµ¼ÈëSql ServerÊý¾Ý¿âÖÐ

C#¡¢ASP.NETÖн«Excel±íÖеÄÊý¾Ýµ¼Èëµ½Sql ServerÊý¾Ý¿âÖжÔÓ¦µÄ±íÖС£
ÕâÀïÎÒÃǽ«E:\test.xls
ÖÐSheet1
±íÖеÄÊý¾Ýµ¼Èëµ½testÊý¾Ý¿âÖеÄmy_test
±íÖС£
Èí¼þ£ºVS2005£¬SQL Server2000,
test.xlsÖÐSheet1±íÖÐÓÐÈý¸ö×ֶΣ¬±àºÅ¡¢Ãû³Æ¡¢±¸×¢¡£¾ßÌåÄÚÈÝÈçÏÂͼ¡£




1¡¢
Ê×ÏÈ£¬ÎÒÃÇÒ ......

C#——·ÃÎÊSQL Server 2005¹«¹²Àà

ÏÂÃæÊÇÎÒ×ܽá³öÀ´µÄÒ»¸öÊý¾Ý¿â·ÃÎʹ«¹²À࣬»ùÓÚADO.NET£¬C#µÄ£¬ÆäÖУ¬ÒÔÖØÔصķ½Ê½ÊµÏÖʹÓôæÊô¹ý³ÌµÄ½Ó¿ÚºÍ²»Óô洢¹ý³ÌµÄ½Ó¿Ú£¬ÈçÓв»Í×Çë´ó¼ÒÖ¸Õý£¬Ð»Ð»~
×÷Õߣºshinehoo
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace shineh ......

ASP.Net + SQL Server ´æ´¢¹ý³ÌʵÏÖ·ÖÒ³ÅÅÐò

ÎÊÌâÌá³ö:
ÔÚÓ¦ÓóÌÐòÖо­³£ÐèÒª²éѯÊý¾Ý¡£µ±²éѯ½á¹ûÊý¾ÝÁ¿±È½Ï´óµÄʱºò£¬¼ìË÷½á¹û¡¢½çÃæÏÔʾ¶¼ÐèÒª»¨·Ñ´óÁ¿µÄʱ¼ä¡£ÎªÁ˱ÜÃâÕâ¸öÎÊÌ⣬Ӧ¸Ãÿ´ÎÖ»¼ìË÷²¿·ÖÊý¾Ý£¬Ò²¾ÍÊÇʹÓó£¼ûµÄ·ÖÒ³·½Ê½À´´¦Àí¡£·ÖÒ³µÄÎÊÌâÔÚasp.netÖкÃÏñ·Ç³£¼òµ¥£¬Ö»ÒªÔÚGridViewÖÐÆôÓ÷ÖÒ³¾Í¿ÉÒÔÁË¡£ÆôÓ÷ÖÒ³ºó£¬GridView¹ØÁªÊý¾ÝÔ´¿Ø¼þ£¬ÒÀ¾É»á¼ÓÔØ ......

ʹÓÃHibernate+MySql+native SQLµÄBUG,ÒÔ¼°½â¾ö°ì·¨

±¾À´ÊÇmssql+hibernate+native SQL Ó¦ÓõĺܺÍг
µ«Êǵ½ÁË°Ñmssql»»³Émysql£¬¾Í³öÁË´í(ͬÑùµÄÊý¾Ý½á¹¹ºÍÊý¾Ý)¡£
²éѯ·½·¨ÊÇ£º
String sql =
"select id XXX_ID from t_tab";
List<Map> list = session.createSQLQuery(sql)
.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP)
.list();
´í ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ