Click here to Skip to main content
15,923,051 members
Home / Discussions / Database
   

Database

 
AnswerRe: Using dynamic SQL Pin
PIEBALDconsult29-Jun-10 18:29
mvePIEBALDconsult29-Jun-10 18:29 
GeneralRe: Using dynamic SQL Pin
Tim Carmichael30-Jun-10 7:29
Tim Carmichael30-Jun-10 7:29 
GeneralRe: Using dynamic SQL Pin
PIEBALDconsult30-Jun-10 15:57
mvePIEBALDconsult30-Jun-10 15:57 
Questionxp_cmdshell Pin
It_tech28-Jun-10 2:11
It_tech28-Jun-10 2:11 
AnswerRe: xp_cmdshell Pin
J4amieC28-Jun-10 2:28
J4amieC28-Jun-10 2:28 
GeneralRe: xp_cmdshell Pin
It_tech28-Jun-10 3:17
It_tech28-Jun-10 3:17 
QuestionBinding source does not update when the linked table is updated in code. Pin
Christian Yeates28-Jun-10 0:17
Christian Yeates28-Jun-10 0:17 
Questionxp_cmdshell [modified] Pin
It_tech26-Jun-10 23:27
It_tech26-Jun-10 23:27 
Hi All,

I have a very strange problem with xp_cmdshell. Here is a Stored Procedure that is meant to execute a VB script file.When i run the VB Script independently it works fine.

But when i execute the stored procedure that is pointing to this VB script file it runs with No error But Doesnt do the work.

Stored Procedure


USE [Database]
GO
/****** Object: StoredProcedure [dbo].[sp_SendSMS] Script Date: 06/27/2010 10:14:13 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[sp_SendSMS]
-- Add the parameters for the stored procedure here
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @Numbers NVARCHAR(200)
DECLARE @Body NVARCHAR(160)
DECLARE @Command NVARCHAR(500)

-- Insert statements for procedure here
SET @Numbers = '00442345672'
SET @Body = CAST(GETDATE() AS NVARCHAR(20)) + ' Test Message'

-- TODO: Get Revenue Statistics and append them to @Command
SET @Command = 'd:\test\SendSMS.vbs /Numbers:' + @Numbers + ' /Body: "' + @Body + '"'

EXEC xp_cmdshell @Command
END



The VB script file is under test folder on D drive which has Read write permission set on the folder.

Set WshShell = WScript.CreateObject("WScript.Shell")
sNumbers= WScript.Arguments.Named.Item("numbers")
sBody= WScript.Arguments.Named.Item("body")
URL = "http://sampleweb.com/samplepage.aspx?IFVERSION=210000&MESSAGETYPE=10&OADC=00447956053317&MESSAGEID=3333&RECEIVETIME=20070320151916&BODY=This%20is%20my%204th%20message%20on%20the%20LIVE%20TV&MCLASS=2&HEADER=0048001&DESTADDRESS=1234&CONNECTION=MIG01l1&DCS=240&RETRYCOUNT=3&PID=0&AVSTATUS=1&GUID=9BBA5E93-390C-450C-94C3-1122E5D4858B"
WshShell.Run(URL)
Set WshShell = Nothing



When i run the VBS file Independently it works fine.However when running the stored procedure above which contains the file i dont see the file being excuted.


Could You please advice what is going Worng?

Thanks for your time.

modified on Sunday, June 27, 2010 6:43 AM

AnswerRe: xp_cmdshell Pin
J4amieC27-Jun-10 21:53
J4amieC27-Jun-10 21:53 
GeneralRe: xp_cmdshell Pin
It_tech28-Jun-10 2:21
It_tech28-Jun-10 2:21 
GeneralRe: xp_cmdshell Pin
J4amieC28-Jun-10 3:32
J4amieC28-Jun-10 3:32 
GeneralRe: xp_cmdshell Pin
It_tech28-Jun-10 4:09
It_tech28-Jun-10 4:09 
GeneralRe: xp_cmdshell [modified] Pin
It_tech28-Jun-10 3:28
It_tech28-Jun-10 3:28 
QuestionQuery for multiple occurance Pin
Nikhil Bhivgade26-Jun-10 2:16
professionalNikhil Bhivgade26-Jun-10 2:16 
AnswerRe: Query for multiple occurance [Solved] Pin
thatraja26-Jun-10 4:02
professionalthatraja26-Jun-10 4:02 
QuestionJoin tables from different server Pin
Naunt24-Jun-10 23:58
Naunt24-Jun-10 23:58 
AnswerRe: Join tables from different server Pin
Covean25-Jun-10 0:55
Covean25-Jun-10 0:55 
AnswerRe: Join tables from different server Pin
CitrusTech25-Jun-10 1:02
CitrusTech25-Jun-10 1:02 
AnswerRe: Join tables from different server Pin
J4amieC25-Jun-10 1:29
J4amieC25-Jun-10 1:29 
AnswerRe: Join tables from different server Pin
Naunt25-Jun-10 3:00
Naunt25-Jun-10 3:00 
QuestionJan-December chart with specific information Pin
Dave McCool24-Jun-10 22:44
Dave McCool24-Jun-10 22:44 
AnswerRe: Jan-December chart with specific information Pin
riced25-Jun-10 1:21
riced25-Jun-10 1:21 
GeneralRe: Jan-December chart with specific information Pin
Dave McCool25-Jun-10 1:39
Dave McCool25-Jun-10 1:39 
Questionsql function to calculate work hours of an employee Pin
Thanusree Duth24-Jun-10 21:03
Thanusree Duth24-Jun-10 21:03 
AnswerRe: sql function to calculate work hours of an employee Pin
thatraja24-Jun-10 23:56
professionalthatraja24-Jun-10 23:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.