Welcome! Log In Create A New Profile

Advanced

How to Run a MS SQL Store Procedure and get the Value from it to a Variable

Posted by MPD_For_Life 
How to Run a MS SQL Store Procedure and get the Value from it to a Variable
February 09, 2021 02:32AM
Hello everyone and Thank you in advance for the Help

I have this stored procedure inside a Microsoft Sequel Database which gets me the Date and Time of the Server.

Name of the Procedure: Get_The_Date_And_Time

Structure of the Procedute

CREATE PROCEDURE dbo.Get_The_Date_And_Time
AS
BEGIN
/* Procedure body */
DECLARE @Date_And_Time as date SELECT Date_And_Time = GETDATE();
END


The result of the Procedure if executed is the following:
Under the Column Name "Get_The_Date_And_Time" The result is the Following


2/8/2021 8:10:19 PM <-------- This is the Date and Time of the Server when the stored procedure is Executed

My question is: How can I run this store procedure from within WinDev or WebDev and put the result in a Variable, for Example varServerDate.

I have tried different things HExecuteProcedure() This does not work with ODBC Connection
I Have tried with HExecuteSQLQuery Get errors
I have tried SQLExec got errors too


Nothing works

I would really appreciate it you can give me a hand on this and perhaps a code Example can be provided since I have no clue where to start.

Thank you so Much

Best regards,
Carlos




Edited 2 time(s). Last edit at 02/09/2021 02:43AM by MPD_For_Life.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: