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

°ï濴ϵݹéSQL£¬Êý¾Ý»¹ÊÇÓеãÎÊÌâ(SQL2K)¼ÙÆÚÎʹý¡£

http://topic.csdn.net/u/20091006/15/4e5624a8-c975-4442-b470-7f0262e81268.html
µ±µÚ3²½Ò²°üº¬µÚÒ»²½µÄ°ë³ÉÆ·£¬ÄÇô½á¹ûÓеãÎÊÌâ¡££¨ÏȰÑ--select 15,4,'H-HP-WH2980',1 union all£©×¢ÊÍ£¬³öÀ´µÄÊý¾ÝûÎÊÌ⣬²»×¢Ê͵Äʱºò¾Í²»¶Ô£¬Âé·³¿´Ï¡£

Select * into SP_ProductP  from (select 11 as ProductP_ID ,19 as ProductP_PID ,1 as ProductP_Order  union all select 12,19,2 union all select 15,19,3 )  as aa
Select * into SP_ProductPItem from (
select 11 as ProductPI_PID ,2 as ProductPI_Type  ,'BD0001' as ProductPI_MHNO,11 as ProductPI_UQty  union all
select 11,2,'BD0003',20 union all
select 11,2,'BD0022',5 union all
select 12,2,'BD0005',3 union all
select 12,4,'H-HP-WH2980',2 union all
select 12,2,'BD0001',2 union all

--select 15,4,'H-HP-WH2980',1 union all
select 15,4,'H2-HP-WH2980',3 union all
select 15,2,'BD0008',5
) as bb


CREATE FUNCTION f_Bom(
@PID int
)RETURNS @t TABLE(ProductPI_PID int,ProductPI_Type int,ProductPI_MHNO varchar(20),ProductPI_UQty int,ProductP_Order int,Level int)
AS
BEGIN
    DECLARE @Level int,@sRow int
    SET @Level=1
Select @sRow =max(ProductP_Order) from SP_ProductP  Where  ProductP_PID =@PID

    INSERT @t
select sub.ProductPI_PID


Ïà¹ØÎÊ´ð£º

ÇóSQL£¿

´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e 
ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......

sql ÎÊÌâ

PBÖпª·¢µÄ¡£

DateTime startTime=DateTime(em_1.Text)
DateTime endTime=DateTime(em_2.Text)

string sql
sql = dw_1.GetSQLSelect()+"Where (StartTime> '"+startTime+&q ......

ÇóÒ»¸ösql Óï¾ä

  table1
  Ãû³Æ      Èë¿âÊý
  CT»ú        3   
  CT»ú        5
  X¹â»ú      4 ......

SQL ¶à±í²éѯ²é³öËùÒªµÄÊý¾Ý£¿

ÒÑÖª´ÓB,±íÖÐÕÒ³öID, NAMEÁ½ÏîÓëC±íÏàͬµÄÊý¾Ý£¬ÔÙÒÀ¾ÝB±íÖо­¹ý²éѯ³öÀ´µÄID,CODEÁ½ÏîÊý¾Ý²éѯÓëA±íID,CODEÁ½ÏîÏàͬµÄÊý¾ÝÖжÔÓ¦µÄEMAILÀ´£¬²¢ÁгöÈçÏÂD±íµÄÐÎʽ£¬²»ÖªÎÒÊÇ·ñ±íʾÇå³þ£¿Âé·³°ïÎÒÁÐһϹ«Ê½ºÃÂð£¿Íò· ......

C# Á¬½ÓSQLÊý¾Ý¿â³£ÓõÄÁ¬½Ó×Ö·û´®¸ÃÈçºÎд£¿

£¨1£©string ConnString = "server=localhost;integrated security=sspi;database=pubs;";   
£¨2£©string strConnection="user uid=sa;pwd=123456;Database=test;Server=test;Connect ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ