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

SQLÒ»¸ö´æ´¢¹ý³Ìµ÷ÓÃÁíÒ»¸ö´æ´¢¹ý³Ì »ñµÃ·µ»ØÖµÎÊÌâ

µÚÒ»ÖÖ·½·¨: ʹÓÃoutput²ÎÊý
USE AdventureWorks;
GO
IF OBJECT_ID ( 'Production.usp_GetList', 'P' ) IS NOT NULL
    DROP PROCEDURE Production.usp_GetList;
GO
CREATE PROCEDURE Production.usp_GetList @product varchar(40)
    , @maxprice money
    , @compareprice money OUTPUT
    , @listprice money OUT
AS
    SELECT p.name AS Product, p.ListPrice AS 'List Price'
    from Production.Product p
    JOIN Production.ProductSubcategory s
      ON p.ProductSubcategoryID = s.ProductSubcategoryID
    WHERE s.name LIKE @product AND p.ListPrice < @maxprice;
-- Populate the output variable @listprice.
SET @listprice = (SELECT MAX(p.ListPrice)
        from Production.Product p
        JOIN  Production.ProductSubcategory s
          ON p.ProductSubcategoryID = s.ProductSubcategoryID
        WHERE s.name LIKE @product AND p.ListPrice < @maxprice);
-- Populate the output variable @compareprice.
SET @compareprice = @maxprice;
GO
ÁíÒ»¸ö´æ´¢¹ý³Ìµ÷ÓõÄʱºò:
Create Proc Test
as
DECLARE @compareprice money, @cost money
EXECUTE Production.usp_GetList '%Bikes%', 700,
    @compareprice OUT,
    @cost OUTPUT
IF @cost <= @compareprice
BEGIN
    PRINT 'These products can be purchased for less than
    $'+RTRIM(CAST(@compareprice AS varchar(20)))+'.'
END
ELSE
    PRINT 'The prices for all products in this category exceed
    $'+ RTRIM(CAST(@compareprice AS varchar(20)))+'.'
µÚ¶þÖÖ·½·¨:´´½¨Ò»¸öÁÙʱ±í
create proc GetUserName
as
begin
    select 'UserName'
end
Create table #tempTable (userName nvarchar(50))
insert into #tempTable(userName)


Ïà¹ØÎĵµ£º

SQL SERVER ÓëACCESS¡¢EXCELµÄÊý¾Ýת»»

 ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾ ......

dz̸»ùÓÚSQL Server ·ÖÒ³´æ´¢¹ý³ÌµÄÑݽø

 ¼òµ¥Ì¸»ùÓÚSQL SERVER ·ÖÒ³´æ´¢¹ý³ÌµÄÑݽø
×÷ÕߣºÖ£×ô
ÈÕÆÚ£º2006-9-30
Õë¶ÔÊý¾Ý¿âÊý¾ÝÔÚUI½çÃæÉϵķÖÒ³ÊÇÀÏÉú³£Ì¸µÄÎÊÌâÁË£¬ÍøÉϺÜÈÝÒ×ÕÒµ½¸÷Ö֓ͨÓô洢¹ý³Ì”´úÂ룬¶øÇÒÓÐЩ»¹¶¨ÖƲéѯÌõ¼þ£¬¿´ÉÏȥʹÓúܷ½±ã¡£±ÊÕß´òËãͨ¹ý±¾ÎÄÒ²À´¼òµ¥Ì¸Ò»Ï»ùÓÚSQL SERVER 2000µÄ·ÖÒ³´æ´¢¹ý³Ì£¬Í¬Ê±Ì¸Ì¸SQL SER ......

SQL Server 2005 Analysis Services²¿Êðʱ±¨¸æ´íÎó

 Êý¾ÝÔ´......°üº¬ÎÞ·¨ÓÃÓÚ´¦Àí²Ù×÷µÄ ImpersonationMode¡£
½â¾ö·½·¨£º
·þÎñÆ÷Á¬½Ó¸ÄΪ“ʹÓ÷þÎñÕË»§”¡£
¾ßÌå²Ù×÷£º
ÔÚÊý¾ÝÔ´ÀïµÄÏîÄ¿Éϵã»÷ÓÒ¼ü->´ò¿ª->Êý¾ÝÔ´Éè¼ÆÆ÷ £¬ Ñ¡Ôñ“Ä£ÄâÐÅÏ¢”±êÇ©->Ñ¡Ôñ“ʹÓ÷þÎñÕË»§”£¬È·¶¨£¬Ö´Ðв¿Êð¡£ ......

sqlÓï¾ä

 1. ˵Ã÷£º¸´ÖƱí(Ö»¸´Öƽṹ£¬Ô´±íÃû£ºa£¬Ð±íÃû£ºb)
SQL: select * into b from a where 1<>1;
        2. ˵Ã÷£º¿½±´±í(¿½±´Êý¾Ý£¬Ô´±íÃû£ºa£¬Ä¿±ê±íÃû£ºb)
SQL: insert into b(a, b, c) select d, e, f from b;
        3. ......

´ÓËã·¨ÈëÊÖ½²½âSQL ServerµÄµäÐÍʾÀý

 ServerÊý¾Ý¿âÖÐʵÏÖ×îÓÅ×î¼òµÄÕû¸ö¹ý³Ì¡£
Ëã·¨ÊǼÆËã»ú¿ÆѧÖÐÒ»¸öÖØÒªµÄÑо¿·½Ïò£¬Êǽâ¾ö¸´ÔÓÎÊÌâµÄ¹Ø¼ü¡£ÔÚ¼ÆËã»úÊÀ½çÖУ¬Ëã·¨ÎÞ´¦²»ÔÚ¡£Êý¾Ý¿âÊÇ´æ´¢Êý¾ÝºÍÖ´ÐдóÅúÁ¿¼ÆËãµÄ³¡Ëù£¬ÔÚÊý¾Ý¿âÖÐʹÓÃһЩ¼òµ¥µÄSQLÃüÁ½øÐд洢¡¢²éѯ¡¢Í³¼Æ¡¢ÒÔ½â¾öÏÖʵÊÀ½çÖеÄÎÊÌâÒѾ­ÊÇÂżû²»ÏÊ¡£Ëæ×ÅÊý¾ÝÁ¿µÄ´ó·ù¶ÈÔö¼ÓºÍÒµÎñ¹æ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ