Click here to download VisualGSM SMS Gateway



sms software
About UsHow to buyDownloadSitemapContact Us
 
Our ProductsServicesNews & EventsOnline DemoCustomer SupportClient/UsersPartner Program


  Reply to this topicStart new topicStart Poll

> Returning results from a SQL stored procedure, SQL Stored Procedure
GBGrendel
Posted: Oct 19 2007, 10:03 AM
Quote Post


Newbie
*

Group: Members
Posts: 2
Member No.: 472
Joined: 27-March 07



I am trying to return results from a Microsoft SQL Stored Procedure. I am calling the following SQL statement:

EXEC pr__sms_mayfly_pull {M}

The stored procedure returns a field called "sms_message". The procedure runs without anything in the Succ Return field but when I put {sms_message} in the Succ Return, and test it, I get the error:

Test Successfully. The return is followed: ERROR FIELD

When I run this directly from SQL, I get the results correctly.

Please help. Thanks, Neil
PMEmail Poster
Top
admin
Posted: Oct 22 2007, 04:15 AM
Quote Post


Administrator
***

Group: Admin
Posts: 1074
Member No.: 1
Joined: 5-May 03





--------------------
VisualGSM SMS Gateway.
VisualGSM SMS Server Downloads.
PMEmail Poster
Top
GBGrendel
Posted: Oct 29 2007, 09:14 AM
Quote Post


Newbie
*

Group: Members
Posts: 2
Member No.: 472
Joined: 27-March 07



I managed to resolve this issue. The issue was with the type of the text returned. It was returning a TEXT type rather than a CHAR type so I just used the CONVERT(CHAR(8000), field) to change the type and it works fine.
PMEmail Poster
Top
admin
Posted: Oct 29 2007, 04:40 PM
Quote Post


Administrator
***

Group: Admin
Posts: 1074
Member No.: 1
Joined: 5-May 03



QUOTE (GBGrendel @ Oct 29 2007, 09:14 AM)
I managed to resolve this issue. The issue was with the type of the text returned. It was returning a TEXT type rather than a CHAR type so I just used the CONVERT(CHAR(8000), field) to change the type and it works fine.




Yes, SQL action can only process char or varchar.


--------------------
VisualGSM SMS Gateway.
VisualGSM SMS Server Downloads.
PMEmail Poster
Top
admin
Posted: Jan 22 2009, 06:45 AM
Quote Post


Administrator
***

Group: Admin
Posts: 1074
Member No.: 1
Joined: 5-May 03



Here's an example of a stored procedure created using SQL Server Express 2005 Management Studio Express. Refer to the attached screen capture on the setup for the keyword "CHECK". There's a lot you can do with a stored procedure using Transact-SQL functions, here's a reference link.

Note: The DSN section is unfilled since we are querying VisualGSM database. If you need to query an external ODBC Data Source, please create a SYSTEM DSN.

CODE
USE [VGSMDB]

GO

/****** Object:  StoredProcedure [dbo].[sp_RECEIVE_GSM_MODEM_REPLY_VIA_SMPP]    Script Date: 01/22/2009 13:04:42 ******/

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:  <VisualGSM Support>
-- Create date: <16th January 2009>
-- Description: <Demo Stored Procedure to receive SMS from GSM modem
--               Query the Phone Book and then send out the result through SMPP>
-- =============================================

CREATE PROCEDURE [dbo].[sp_RECEIVE_GSM_MODEM_REPLY_VIA_SMPP]

@sendernumber varchar(30),
@smscontent nvarchar(1000),
@port varchar(20)

AS

BEGIN

DECLARE @queryresult varchar(50)

SET @queryresult = (SELECT phonenumber FROM USERLIST where OWNERNAME LIKE @smscontent)

IF @queryresult<>''

INSERT into LOGLOG (commmethod,destination,content)
VALUES ('smpp-1',@sendernumber,'The contact number for '+@smscontent+' is '+@queryresult)  

ELSE

INSERT into LOGLOG (commmethod,destination,content)
VALUES ('smpp-1',@sendernumber,'Sorry, the record for '+@smscontent+' cannot be found.')

END


Attached Image
Attached Image


--------------------
VisualGSM SMS Gateway.
VisualGSM SMS Server Downloads.
PMEmail Poster
Top
chillpill
Posted: Oct 21 2009, 09:25 PM
Quote Post


Newbie
*

Group: Members
Posts: 2
Member No.: 2159
Joined: 29-September 09



Please can you show how to pass in an OUTPUT PARAMETER and have this in Succ Return?
PMEmail Poster
Top
admin
Posted: Oct 22 2009, 07:46 AM
Quote Post


Administrator
***

Group: Admin
Posts: 1074
Member No.: 1
Joined: 5-May 03



You can toggle "SELECT" and put the fieldname in curly brackets within the Succ Return field.


--------------------
VisualGSM SMS Gateway.
VisualGSM SMS Server Downloads.
PMEmail Poster
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.0747 ]   [ 12 queries used ]   [ GZIP Disabled ]