SQL Server²é詢¿ÉÓôÅÅÌ¿Õ¼ä
--> Title : SQL Server²é詢¿ÉÓôÅÅÌ¿Õ¼ä
--> Author : wufeng4552
--> Date : 2009-10-30 09:59:09
Ç°ÑÔ
Èç¹ûÄãµÄ×éÖ¯ÓµÓеijÌÐòÒªÇóÒ»¸öºÜ´óÁ¿µÄ´ÅÅÌ¿Õ¼ä»òÕß´ó±ÈÀýµÄÌض¨´ÅÅÌ£¬ÄÇôȷ±£ÔÚ³ÌÐò¿ªÊ¼»òÕ߹ؼüµãʱȷÈÏ´ÅÅÌÇý¶¯Æ÷¾ßÓÐ×ã¹»µÄ´æ´¢¡£Ò»´Î¿ìËÙ¼ì²é¾Í¿ÉÒÔ½ÚÔ¼´óÁ¿µÄʱ¼ä£¬¼õÉÙ·³ÄÕºÍÖØй¤×÷
Èç¹û´ÅÅÌ¿Õ¼äºÜ½ôÕÅ»òÕß´ó±ÈÀýµÄ´ÅÅÌÐèÒªÓÃÀ´½øÐиýø³Ì£¬ÄÇôÔÚ¼ÌÐø½øÐÐÒ»¸ö½ø³Ì֮ǰ¼ì²é´ÅÅÌ¿Õ¼äÊÇÒ»¸öÃ÷ÖÇÖ®¾Ù. ʹÓÃSQL Server 2000 µ½ 2008¶¼ÌṩµÄxp_fixeddrivesÀ©Õ¹´æ´¢¹ý³Ì½â¾öÕâ¸öÎÊÌâ.
if object_id('sp_exec_getDiskSpace','P')is not null
drop proc sp_exec_getDiskSpace
go
create proc sp_exec_getDiskSpace
(
@minMBfree int,
@Drive varchar(2)
)
as
begin
declare @MBfree int
select @MBfree=0
create table #tb_DiskSpace
([Drive] varchar(2),
[MBfree] int)
insert #tb_DiskSpace exec master.dbo.xp_fixeddrives
select @mbfree=[MBfree]
from #tb_DiskSpace
where [Drive]=@Drive
if @MBfree>@minMBfree
return
else
begin
raiserror ('*** ERROR *** - ´Å盤¿Õ間²»×ã!', 16, 1)
end
drop table #tb_DiskSpace
end
go
exec sp_exec_getDiskSpace 10240,'C'
/*
(5 個資ÁÏÁÐÊܵ½Ó°響)
訊Ï¢50000£¬層級16£¬狀態1£¬³ÌÐòsp_exec_getDiskSpace£¬ÐÐ21
*** ERROR *** - ´Å盤¿Õ間²»×ã!
*/
exec sp_exec_getDiskSpace 10240,'C'
Ïà¹ØÎĵµ£º
ÈçºÎ°ÑAccessת³ÉSQL ServerµÄ·½·¨½éÉÜ
ºÜ¶àÅóÓÑÏëÓÃSQL 2000Êý¾Ý¿âµÄ±à³Ì·½·¨£¬µ«ÊÇÈ´ÓÖ¿àÓÚ×Ô¼ºÊÇѧAccessµÄ£¬¶ÔSQLÖ»ÊÇÒ»µãµãµÄÁ˽â¶øÒÑ£¬ÕâÀïÎÒ¸ø´ó¼ÒÌṩÒÔϲο¼---½«Accessת»¯³ÉSQL 2000µÄ·½·¨ºÍ×¢ÒâÊÂÏî¡£Ê×ÏÈ£¬ÎÒ˵µÄÊÇÔÚAccess 2000£¬SQL 2000Ö®¼äת»»£¬ÆäËûµÄÎÒÒ²»¹Ã»Óг¢ÊÔ¹ý£¬Ï£ ......
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶Ë×Ö·ûµÄASCII ÂëÖµ¡£ÔÚASCII£¨£©º¯ÊýÖУ¬´¿Êý×ÖµÄ×Ö·û´®¿É²»ÓÑ’À¨ÆðÀ´£¬µ«º¬ÆäËü×Ö·ûµÄ×Ö·û´®±ØÐëÓÑ’À¨ÆðÀ´Ê¹Ó㬷ñÔò»á³ö´í¡£
2¡¢CHAR()
½«ASCII Âëת»»Îª×Ö·û¡£Èç¹ûûÓÐÊäÈë0 ~ 255 Ö®¼äµÄASCII ÂëÖµ£¬CHAR£¨£© ·µ»ØNULL ¡£
3¡¢LOWER()ºÍ ......
º¯Êý£º
XMLPARSE£º½âÎö×Ö·û»òÕß´ó¶ÔÏó¶þ½øÖÆÊý¾Ý£¬²úÉúXML
XMLSERIALIZE£º½«XMLֵת»»Îª×Ö·û»òÕß´ó¶ÔÏó¶þ½øÖÆÊý¾Ý
XMLVALIDATE£º¸ù¾ÝXML schemaУÑéXMLÖµµÄÓÐЧÐÔ
XMLEXISTS£º¼ì²âXQueryÊÇ·ñ·µ»Ø½á¹û£¨ÈçÓÉÒ»¸ö»ò¶à¸öÏîËù×é³ÉµÄÐòÁУ©
XMLQUERY£ºÖ´ÐÐÒ»¸öXQuery²¢ÒÔÒ»¸öÐòÁзµ»Ø½á¹û
XMLTABLE£ºÖ´ÐÐÒ»¸öXQuery£¬ÒÔ¹ØÏ ......
/*µ±Ö´ÐÐSQLʱ·¢ÏÖ²»ÄÜÁ¬½ÓÊý¾Ý¿â£¬ÏÈÖØÁ¬Ò»´Î*/
import java.io.FileInputStream;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
......