Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 server ´æ´¢¹ý³ÌÑ­»·¸³ÖµµÄÎÊÌâ

СµÜÊǸöÐÂÊÖ ÏÖÔÚÓиöÎÊÌâÒ»Ö±²»Äܽâ¾ö
ÀýÈç
procedure produce_proc
    @p001 nvarchar(8000),
    @p002 nvarchar(8000),
    @p003 nvarchar(8000),
  & ......

¹ØÓÚgroup byµÄsqlÓï¾ä£¿

  with adod_dict do
    begin
    close;
    commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......

×Ü»áÅöµ½¹ÖµÄÎÊÌ⣬sqlÎÊÌâ

sql2005
select *from v_ddxx where d_sfsc='0' and (g_ssbm='1001' or g_ssbm='1002') and (xxf>0 and  xxfwzf <>0 ),Ö´ÐÐËÙ¶ÈÂýµÄÒªËÀ£¬µ«ÊÇÈç¹û°Ñ(xxf>0 and  ......

SQLÓï¾äÎÊÌ⣬¸ßÊÖ°ïæ£¡£¡

½«Ò»¸ö±í21~30ɾ³ý£¬sqlÓï¾äÔõôд
Õâ¸öÌ«ÁýͳÁË£¬ÊÇÅÅÐòºóµÄµÚ21Ìõµ½30Ìõ¼Ç¼ɾ³ý»¹ÊÇijһÁÐÖµÔÚ21µ½30Ö®¼äµÄɾ³ý°¡£¿

21-30ÊÇʲôÒâ˼£¿×ֶεϰ¾Ídelete from table1 where col1>=21 and col1<=30
Ö¸µ ......

sqlÓï¾ä¶à±í¶à×ֶβéѯ - MS-SQL Server / »ù´¡Àà

ÎÒÓжà¸ö±íA B C ½á¹¹ÊÇÒ»ÑùµÄ£¬¶¼ÓÐ2¸ö×Ö¶ÎnameºÍcontent,ÎÒÒªËÑË÷ËùÒÔ±íËùÓÐ×Ö¶ÎÖаüº¬¡°Öйú¡±µÄÄÚÈÝ Õâ¸öSQLÓï¾äÔõôд 

ÈçºÎ½«¶à¸ö±íµÄ²éѯ½á¹ûÁ¬³ÉÒ»¸ö±í Õâ¸öSQLÓï¾äÔõôд ±íµÄ½á¹¹ÊÇÒ»ÑùµÄ
ÀýÈç£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ