ÀûÓÃSQLÒƶ¯Ó²ÅÌÎļþ
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[p_movefile]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[p_movefile]
GO
/*--Òƶ¯·þÎñÆ÷ÉϵÄÎļþ
²»½èÖú xp_cmdshell ,ÒòΪÕâ¸öÔÚ´ó¶àÊýʱºò¶¼±»½ûÓÃÁË
--×Þ½¨ 2004.08(ÒýÓÃÇë±£Áô´ËÐÅÏ¢)--*/
/*--µ÷ÓÃʾÀý
exec p_movefile 'd:\aa.txt','c:\'
--*/
create proc p_movefile
@s_file varchar(1000), --Ô´Îļþ
@d_file varchar(1000) --Ä¿±êÎļþ
as
declare @err int,@src varchar(255),@desc varchar(255)
declare @obj int
exec @err=sp_oacreate 'Scripting.FileSystemObject',@obj out --ÔÚ Microsoft? SQL Server? ʵÀýÉÏ´´½¨ OLE ¶ÔÏóʵÀý
if @err<>0 goto lberr
exec @err=sp_oamethod @obj,'MoveFile',null,@s_file,@d_file --µ÷Óà OLE ¶ÔÏóµÄ·½·¨
if @err<>0 goto lberr
exec @err=sp_oadestroy @obj --ÊÍ·ÅÒÑ´´½¨µÄ OLE ¶ÔÏó¡£
return
lberr:
exec sp_oageterrorinfo 0,@src out,@desc out --»ñÈ¡ OLE ×Ô¶¯»¯´íÎóÐÅÏ¢¡£
select cast(@err as varbinary(4)) as ´íÎóºÅ
,@src as ´íÎóÔ´,@desc as ´íÎóÃèÊö
go
Ïà¹ØÎĵµ£º
ÔÚWindows 2003 sp1·þÎñÆ÷ÉÏȱʡ°²×° MS SQL Server 2005 ¼òÌåÖÐÎÄÆóÒµ°æ£¬ÔÚÁ¬½Ó·þÎñÆ÷ʱÏÔʾ“²»ÔÊÐíÔ¶³ÌÁ¬½Ó”¡£
¾ßÌåÏÔʾÈçÏ£º(xxxxxsqlΪ·þÎñÆ÷Ãû£¬ÔÚ±¾µØ²Ù×÷)
C:\Documents and Settings\Administrator>sqlcmd -S xxxxxsql
HResult 0x2£¬¼¶±ð 16£¬×´Ì¬ 1
ÃüÃû¹ÜµÀÌṩ³ÌÐò: ÎÞ·¨´ò¿ªÓë SQL Server ......
SQLÖÐDATEADDºÍDATEDIFFµÄÓ÷¨
ÈÕÆÚ:2008-07-17 ×÷Õß:ϲ騰С¶þ 來Ô´:PHPChina
ͨ³££¬妳ÐèÒª獲µÃ當Ç°ÈÕÆÚºÍ計ËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬妳µÄ³ÌÐò¿ÉÄÜÐèÒªÅÐ斷Ò»個ÔµĵÚÒ»Ìì»òÕß×îááÒ»Ìì¡£妳們´ó²¿·ÖÈË´ó¸Å¶¼ÖªµÀÔõ樣°ÑÈÕÆÚ進ÐзָÄê ......
ÔÚËÑË÷Êý¾Ý¿âÖеÄÊý¾Ýʱ£¬SQL ͨÅä·û¿ÉÒÔÌæ´úÒ»¸ö»ò¶à¸ö×Ö·û¡£
SQL ͨÅä·û±ØÐëÓë LIKE ÔËËã·ûÒ»ÆðʹÓá£
ÔÚ SQL ÖУ¬¿ÉʹÓÃÒÔÏÂͨÅä·û£º
ͨÅä·ûÃèÊö
%
Ìæ´úÒ»¸ö»ò¶à¸ö×Ö·û
_
½öÌæ´úÒ»¸ö×Ö·û
[charlist]
×Ö·ûÁÐÖеÄÈκε¥Ò»×Ö·û
[^charlist]
»òÕß
[!charlist]
²»ÔÚ×Ö·ûÁÐÖеÄÈκε¥Ò»×Ö·û
ÔʼµÄ±í (ÓÃÔÚÀý×ÓÖ ......
×î½ü¼¸ÖÜÒ»Ö±ÔÚ½øÐÐÊý¾Ý¿âÅàѵ£¬ÀÏʦ¾«Õ¿µÄ¼¼ÊõºÍÉú¶¯µÄ½²½âʹÎÒÊÜÒæ·Ëdz¡£ÎªÁËÈøü¶àµÄÐÂÊÖÊÜÒ棬ÎÒ³é¿Õ°ÑSQLÓï¾äÓÅ»¯²¿·Ö½øÐÐÁËÕûÀí£¬Ï£Íû´ó¼ÒÒ»Æð½ø²½¡£¡¡¡¡
¡¡¡¡Ò»¡¢²Ù×÷·ûÓÅ»¯¡¡¡¡
¡¡1¡¢IN ²Ù×÷·û ¡¡¡¡
¡¡¡¡ÓÃINд³öÀ´µÄSQLµÄÓŵãÊDZȽÏÈÝÒ×д¼°ÇåÎúÒ׶®£¬Õâ±È½ÏÊʺÏÏÖ´úÈí¼þ¿ª·¢µÄ·ç¸ñ¡£µ«ÊÇÓÃINµÄSQLÐÔÄÜ×ÜÊÇ±È½Ï ......
SQLÊý¾Ý¿âÖÐÓÃimageÀ´´æ´¢Îļþ,µ«SQLûÓÐÌṩֱ½ÓµÄ´æÈ¡ÎļþµÄÃüÁî.
/*--bcp ʵÏÖ¶þ½øÖÆÎļþµÄµ¼Èëµ¼³ö
Ö§³Öimage,text,ntext×ֶεĵ¼Èë/µ¼³ö
imageÊʺÏÓÚ¶þ½øÖÆÎļþ,°üÀ¨:WordÎĵµ,ExcelÎĵµ,ͼƬ,ÒôÀÖµÈ
text,ntextÊʺÏÓÚÎı¾Êý¾ÝÎļþ
×¢Òâ:µ¼Èëʱ,½«¸²¸ÇÂú×ãÌõ¼þµÄËùÓÐÐÐ
µ¼³öʱ,½ ......