是否可以覆盖XP_CMDSHELL程序? [英] Is it possible to override XP_CMDSHELL procedure ?

查看:67
本文介绍了是否可以覆盖XP_CMDSHELL程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在处理一个需要将大数据导出为XML或HTML的应用程序,但问题是我收到错误 -

 过程期望参数'  类型 '  varchar'

。所以问题是有没有可能覆盖程序或其他方式来做这样的事情。



查询是 -

< pre lang =SQL> exec Master..XP_CMDSHELL ' echo< html>< head>< style type =text / css> .login-wrapper {position:absolute; margin-top:15%; text-align:center;}。row-fluid {width:100%;}。row-fluid:before,.row-fluid:after {display:table; line-height:0; content:;}。row-fluid:after {clear:both;}。 row-fluid:before,.row-fluid:after {display:table; line-height:0; content:;} body {font-family:Open Sans,sans-serif; font-size:12px;} body {font-family:Lucida Console,Monaco,monospace; background-color:#f7f7f7; position:relative; font-size:12px; padding:0px; text-decoration:blink; width:auto;} .login-wrapper .box {margin:0 auto; padding:35px 0 30px; float:none; width:500px; box-shadow:0 0 6px 2px rgba(0,0,0,0.1); border-radius:5 px; background:rgba(255,255,255,0.65);}。row-fluid [class * =span] {display:block; box-sizing:border-box;} .login-wrapper .box .content -wrap {width:82%; margin:0 auto;} div {display:block;}< / style>< / head>< body>< div class =row-fluid login-wrapper> < div class =span4 box>< div class =content-wrap>< img alt =iM品牌height =75pxsrc => C:\ Users \ atierp \Desktop \ file.htm'







我需要导出这个文件。它现在是静态的但是是动态数据。



非常感谢帮助。



谢谢,

解决方案

再次:这与此有什么关系xp_cmdshell?

你能解释一下,为什么要使用它,因为它适用于完全不同的东西。它可能看起来很像,但它不是一个命令外壳,你可以做任何事情你可以在cmd.exe中执行。实际上它是为了启动外部进程。但不是那样。

如果你只想写一个OS级别的文件,你还有其他工具。 />
请参阅:

https://www.simple-talk.com/sql/t-sql-programming/reading-and-writing-files-in-sql-server-usin gt-sql / [ ^ ]

http://www.nigelrivett.net/SQLTsql/WriteTextFile.html [ ^ ]


Hi,

I am working on an application which requires a large data to be exported as XML or HTML, But the problem is i am getting an error-

Procedure expects parameter 'command_string' of type 'varchar'.

. So the question is are there any possibilities to override the procedure or some other way to do such thing.

Query is --

exec Master..XP_CMDSHELL 'echo "<html><head><style type="text/css">.login-wrapper {position: absolute;margin-top:15%;text-align: center;}.row-fluid {width: 100%;}.row-fluid:before, .row-fluid:after {display: table;line-height: 0;content: "";}.row-fluid:after {clear: both;}.row-fluid:before, .row-fluid:after {display: table;line-height: 0;content: "";}body {font-family: Open Sans , sans-serif;font-size: 12px;}body {font-family: "Lucida Console", Monaco, monospace;background-color: #f7f7f7;position: relative;font-size: 12px;padding: 0px;text-decoration: blink;width: auto;}.login-wrapper .box {margin: 0 auto;padding: 35px 0 30px;float: none;width: 500px;box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);border-radius: 5px;background: rgba(255, 255, 255, 0.65);}.row-fluid [class*="span"] {display: block;box-sizing: border-box;}.login-wrapper .box .content-wrap {width: 82%;margin: 0 auto;}div {display: block;}</style></head><body><div class="row-fluid login-wrapper"><div class="span4 box"><div class="content-wrap"><img alt="i.M. Branded" height="75px" src="" > C:\Users\atierp\Desktop\file.htm'




I need to export this file. It is static as of now but will be dynamic data.

Help would be very much appreciated.

Thanks,

解决方案

Again: what has this to do with xp_cmdshell?
Can you explain me, why do you want to use it, since it is meant for something totally different. It might look alike, but it is not a command shell you can should to do anything you can do in cmd.exe. Actually it is meant to start external processes. But not like that.
If you want just to write to a file on OS level, you have other tools.
See:
https://www.simple-talk.com/sql/t-sql-programming/reading-and-writing-files-in-sql-server-using-t-sql/[^]
http://www.nigelrivett.net/SQLTsql/WriteTextFile.html[^]


这篇关于是否可以覆盖XP_CMDSHELL程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆