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)
Ïà¹ØÎĵµ£º
¸ÐлÌ῵µÂÂÞ¼ÓµÄͶµÝ
¾ÍÏñµ±Ä겨ʿ¶ÙµÄ°®¹úÕßΪ·´¿¹Ó¢¹úÖØË°µÄÐж¯Ò»Ñù£¬NoSQLµÄÖ§³ÖÕßÃÇ´Ó¸÷µØÓ¿À´£¬·ÖÏíËûÃÇÈçºÎÍÆ·»ºÂý¶ø°º¹óµÄ¹ØÏµÊý¾Ý¿âµÄ±©Õþ£¬ÔõÑùʹÓøüÓÐЧºÍ¸ü±ãÒ˵ķ½·¨À´¹ÜÀíÊý¾Ý£¬ËûÃÇ¿ªÊ¼¶ÔSQL˵²»£¡NoSQL×éÖ¯ÉϸöÔÂÔھɽðɽµÄÐж¯ÈÃÈËÎŵ½ÁËÊý¾Ý¿â¸ïÃüµÄζµÀ£¬ºÃÏñÒ»¸öÏÖ´úITÒµ°æµÄ²¨ ......
DBMS_CHANGE_NOTIFICATION
¶ÔÏó£¨±í£©Êý¾Ý¸üÐÂ֪ͨ
DBMS_APPLICATION_INFO
ÉèÖÃ/¶ÁÈ¡SESSION APPLICATIONÐÅÏ¢£¬²Ù×÷V$SESSION_LONGOPS
DBMS_ALERT
¸æ¾¯
DBMS_DATAPUMP
Êý¾ÝÇ¨ÒÆ
DBMS_DB_VERSION
Êý¾Ý¿â°æ±¾¶¨Òå
DBMS_DDL
Compiles¡¢wrapped¡¢Reorganizes ¶ÔÏó
DBMS_DEBUG
ORACLE DEPL/SQL debugger ¹¤¾ß
DB ......
Question 1£º
Êý¾Ý¿âµÄÑé֤ģʽΪWindowsÑéÖ¤£¬É¾³ýÁËMS SQL ServerÕʺÅBUILTIN\Administrators,µÇ½²»ÉÏSQL Server¹ÜÀíÆ÷£¿
Answer£º
1.ÖØÐÂÔËÐÐMS SQL SERVERµÄ°²×°³ÌÐò£¬ÔÚ“°²×°Ñ¡ÏçÃæÀïÑ¡Ôñ“¸ß¼¶Ñ¡Ï¬ÏÂÒ»²½ºóÑ¡Ôñ“×¢²á±íÖØ½¨”£¬½ÓÏÂÀ´¸ú° ......
ÏȰÑÎı¾½øÐиñʽ´¦Àí£¬È»ºóÒÔ¿Õ¸ñΪ·Ö¸ô·û£¬È¡µÚ¶þ¸ö¿Õ¸ñºóµÄ×Ö´®£¬ÅÅÐò£¬È¥ÖØ£¬ÔÙ½µÐòÅÅÁУ¬È¡Ç°5¸ö
arr=($(cat 0100055F_Detail.txt|sed -e '/:/d'|awk -F ' ' '{print$2}'|sort|uniq -c|sort -nr|head -5|awk '{print $2}'))
len=${#arr[@]} »ñÈ¡Êý×鳤¶È
for((i=0;i<$len;i++))
do
echo ${arr[$i] ......
USE master
GO
DECLARE @SQL VARCHAR(MAX);
SET @SQL=''
SELECT @SQL=@SQL+'; KILL '+RTRIM(SPID)
from master..sysprocesses
WHERE dbid=DB_ID('hotel');
EXEC(@SQL);
GO
ALTER DATABASE hotel SET MULTI_USER ......