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

SQL »ñȡϵͳÎļþ

--»ñµÃµ±Ç°ËùÓÐÇý¶¯Æ÷
exec master.dbo.xp_availablemedia
--»ñµÃ×ÓĿ¼Áбí
exec master.dbo.xp_subdirs 'c:\'
--»ñµÃËùÓÐ×ÓĿ¼µÄĿ¼Ê÷½á¹¹
exec master.dbo.xp_dirtree 'c:\'
--¶©ÔÄÎļþɾ³ý
declare @tempTable table (Cont varchar(50))
declare @strTemp varchar(50)
declare @dirPath varchar(50)
declare @dirOrder varchar(50)
declare @delpath varchar(50)
declare @delOrder varchar(50)
set @dirPath = 'C:\ddt\unc\ZF_TEST_BB\'
set @dirOrder = 'dir '+@dirPath
set @delpath = 'rd/q/s '+@dirPath
insert into @tempTable(Cont) exec master.dbo.xp_cmdshell @dirOrder
DECLARE authors_cursor CURSOR FOR
 select Cont from @tempTable
 where (Cont not like '%'+CONVERT(varchar(50),month(GETDATE()))+'-'+CONVERT(varchar(50),day(GETDATE()))+'%')
 and (Cont like '%'+CONVERT(varchar(50),year(GETDATE()))+'-%')
 OPEN authors_cursor
  FETCH NEXT from authors_cursor into @strTemp
  While @@FETCH_STATUS = 0
  Begin
   set @delOrder = @delpath+ right(@strTemp,14);
   print @delOrder
--   exec master.dbo.xp_cmdshell @delOrder
  FETCH NEXT from authors_cursor into @strTemp
  End
 CLOSE authors_cursor
DEALLOCATE authors_cursor


Ïà¹ØÎĵµ£º

sql ºº×ÖתÊ××ÖĸƴÒô

´ÓÍøÂçÉÏÊÕ¹ÎÁËһЩ£¬ÒÔ±¸ºóÓÃ
create function fun_getPY(@str nvarchar(4000))
returns nvarchar(4000)
as
begin
declare @word nchar(1),@PY nvarchar(4000)
set @PY=''
while len(@str)>0
begin
set @word=left(@str,1)
--Èç¹û·Çºº×Ö×Ö·û£¬·µ»ØÔ­×Ö·û
set @PY=@PY+(case when unicode(@word) b ......

sql´¥·¢Æ÷ʵÏÖ×Ô¶¯±àºÅ¸ñʽ


ʹÓô¥·¢Æ÷À´ÊµÏÖ
create table test(
id varchar(20),
sname varchar(20)
)
create TRIGGER [test_insert] ON [dbo].[test]
INSTEAD OF INSERT
AS
declare @str varchar(20)
declare @i integer
set @str = 'BV'+left(convert(char,getdate(),112),6)
select @i=isnull(max(cast(right(rtrim(id),len(id)-8 ......

sql server 2005 µ¼³öÓû§±íÊý¾Ý×Öµä(×ªÔØ)

-----------------------------------------------------
--×÷ÓãºÓÃÓÚsql server 2005 µ¼³öÓû§±íÊý¾Ý×Öµä
--1 ĬÈϵ¼³öµ±Ç°Êý¾Ý¿âÖÐËùÓÐÓû§±í(xtype = 'u')µÄÊý¾Ý×ֵ䣻
--2 ¿ÉÒÔÔÚxtype = 'u'Ìæ»»ÎªÈçÏÂËùʾÓï¾äxtype = 'u' and name in ('son','Person') µ¼³ö×Ô¶¨ÒåµÄ±íµÄÊý¾Ý×ֵ䣻
--3 ¿ÉÒÔÀûÓü¯³É·þÎñSSISµ¼³ ......

Sql Server Á¬½ÓOracle µÄMSDTCÉèÖÃ

´ò¿ª“¹ÜÀí¹¤¾ß¨D¨D×é¼þ·þÎñ”£¬ÒÔ´Ë´ò¿ª“×é¼þ·þÎñ¨D¨D¼ÆËã»ú”£¬ÔÚ“ÎҵĵçÄÔ”Éϵã»÷ÓÒ¼ü¡£
ÔÚMSDTCÑ¡ÏÖУ¬µã»÷“°²È«ÅäÖÔ°´Å¥¡£
ÔÚ°²È«ÅäÖô°¿ÚÖÐ×öÈçÏÂÉèÖãº
 Ñ¡ÖÐ“ÍøÂçDTC·ÃÎÊ”
 ÔÚ¿Í»§¶Ë¹ÜÀíÖÐÑ¡ÖГÔÊÐíÔ¶³Ì¿Í»§¶Ë”“ÔÊÐ ......

SQL Server [·Ö²¼Ê½²éѯ/ÊÂÎñ]

·Ö²¼Ê½²éѯ
    OPENROWSET
    ´ÓExcelÈ¡Êý¾Ý
    SELECT * from OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=d:\1.xls',[Sheet1$])
    ´ÓOracleÈ¡Êý¾Ý
    SELECT * from OPENROWSET('MSDAORA.1','NetServiceName ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ