今天无意中看到论坛上有人写了如下代码,可以用SqlServer调用操作系统命令,感觉很有用,特别记录一下(但好像很不安全):
EXEC sp_configure 'show advanced options' , 1
GORECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell' ,1
GO
RECONFIGURE
GO
create table #t(temp varchar(1000))
insert into #t Exec sys.xp_cmdshell 'dir c:\windows'
select * from #t
drop table #t