SQL Server calling function

Nov 25, 2013 at 11:19pm
I had developed an application based on WIN API that interact with MS SQL Server.
The connection is established through ODBC.
Anyway, I need to know how to execute a stored procedure or Database built-in function.
I had searched the web, I just found that I have to create SQL CLR project. However, I am wondering if there is another way supplied by ODBC just like executing select, insert or update statements that were successful in my application.

Thanks in advance for your advises and help.
Regards,
Ahmad
Nov 26, 2013 at 2:09pm
Andywestken... ComputerGeek01... Lumpken... Josie...

guys any update????
Nov 26, 2013 at 11:41pm
Hi!

The link below will direct you to the specific library reference in MSDN:

SQLExecute Function:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms713584(v=vs.85).aspx

Essentially, you will do an ODBC "PrepareStatement" and then submit it to the
Execute function.

BTW: To execute a stored procedure, ODBC will not give the same level of detail for modification, etc. as the SQL Workbench. However, you can access and execute a store procedure.

Hope this helps.

Mike
Nov 27, 2013 at 10:41am
Thanks for your info.
I am already using SQLExecute and SQLExecDirect functions while executing SELECT, INSERT and UPDATE statements.
Briefly, the problem I'm facing is:
Any database stored function or user defined function has a return value that must be passed back to the Application level. I am passing the function into the database and executing it successfully. However, I am not able to retrieve its returned value just as we do upon running any SELECT statement. Upon running SELECT statement, we bind each column to the proper variable on application level. Then upon fetching data, the retrieved columns are then returned into those variables.

I hope I am much more clear now.

Regards,
Ahmad
Nov 27, 2013 at 11:00pm
Hello Ahmad,

Check out the following:

http://support.microsoft.com/kb/329497

This hopefully helps solve your request.

Regards
Mike
Topic archived. No new replies allowed.