ÀûÓÃ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
Ïà¹ØÎĵµ£º
c06 --------------7545623Ìõ
c05---------------1032652Ìõ
vc01--------------427741Ìõ
SQL Statement from editor:
select c0602 "ÉÌÆ·±àÂë",c0625 "ÉÌÆ·ÌõÂë",
c0103 "ÉÌÆ·Ãû³Æ",c0104 "¹æ¸ñ",c060 ......
ÔÚËÑË÷Êý¾Ý¿âÖеÄÊý¾Ýʱ£¬SQL ͨÅä·û¿ÉÒÔÌæ´úÒ»¸ö»ò¶à¸ö×Ö·û¡£
SQL ͨÅä·û±ØÐëÓë LIKE ÔËËã·ûÒ»ÆðʹÓá£
ÔÚ SQL ÖУ¬¿ÉʹÓÃÒÔÏÂͨÅä·û£º
ͨÅä·ûÃèÊö
%
Ìæ´úÒ»¸ö»ò¶à¸ö×Ö·û
_
½öÌæ´úÒ»¸ö×Ö·û
[charlist]
×Ö·ûÁÐÖеÄÈκε¥Ò»×Ö·û
[^charlist]
»òÕß
[!charlist]
²»ÔÚ×Ö·ûÁÐÖеÄÈκε¥Ò»×Ö·û
ÔʼµÄ±í (ÓÃÔÚÀý×ÓÖ ......
±¾ÎĵØÖ·£ºhttp://qzone.qq.com/blog/236000056-1217427602
ÎÞ·¨Á¬½Óµ½·þÎñÆ÷
·þÎñÆ÷£ºÏûÏ¢18452, ¼¶±ð16£¬×´Ì¬1
[Microsoft][ODBC SQLServer Driver][SQL Server]Óû§‘sa’µÇ½ʧ°Ü¡£ÔÒò£ºÎ´ÓëÐÅÈÎSQL ServerÁ¬½ÓÏà¹ØÁª
¸Ã´íÎó²úÉ ......
SQLÖÐIN,NOT IN,EXISTS,NOT EXISTSµÄÓ÷¨ºÍ²î±ð:
IN:È·¶¨¸ø¶¨µÄÖµÊÇ·ñÓë×Ó²éѯ»òÁбíÖеÄÖµÏàÆ¥Åä¡£
IN ¹Ø¼ü×ÖʹÄúµÃÒÔÑ¡ÔñÓëÁбíÖеÄÈÎÒâÒ»¸öֵƥÅäµÄÐС£
µ±Òª»ñµÃ¾ÓסÔÚ California¡¢Indiana »ò Maryland ÖݵÄËùÓÐ×÷ÕßµÄÐÕÃûºÍÖݵÄÁбíʱ£¬¾ÍÐèÒªÏÂÁвéѯ£º
SELECT ProductID, ProductName from Northwind.dbo.Pro ......
±È½ÏÁ½¸öSQLµÄÖ´ÐÐʱ¼ä
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PROC_SQL_COMP]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[PROC_SQL_COMP]
GO
/*--²âÊÔÁ½×éSQLµÄƽ¾ùʱ¼ä
ÀûÓÃosql.exeÀ´²âÊÔÁ½×é SQL Óï¾äµÄÖ´ÐÐʱ¼ä
²âÊԵĴ洢¹ý³ ......