Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pointers

Status
Not open for further replies.

Malcav

Programmer
Oct 7, 2005
43
GB
Hi
I am using extendedproc in order to run a 3rd party function in a dll. The function seems to work but instead of returning a long string of text it returns an 8 digit number. Unfortunatly know one who wrote the program or understands it is available and the manual does not cover anything like this.
There was a suggestion that this 8 digit number could be a memory location in which the long string is stored. is there any way of accessing this memory location within sql?
Thanks
Malcav
 
Not really.

Your terms are a little confusing. Is this a function or an extended stored procedure? The two are completely different things. And are we to assume this isn't a SQL system object, but one that was created by the vanished programmer?





Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
by using :
using master
exec sp_dropextendedproc 'AFunction'
exec sp_addextendedproc 'AFunction', 'somedll.dll'

using mydb
EXEC @AString = master.dbo.AFunction "Variable|ID"

print @AString

It runs without error and stored in @AString at the end is :
‘110961644’

the dll was written in c and all examples of how to use it are access or delphi based. However we need to run the function within a stored procedure.
 
Use the below code to find the text of 'AFunction'. Then copy-n-paste the Text into a word pad document or something. Follow along the code to see what it's doing and you'll be able to tell if it should actually be returning text or if the number it's returning is what it should be returning.

Code:
use master

select so.name, sc.text
from sysobjects so
join syscomments sc
on so.ID = sc.ID
where so.name = 'AFunction'

These are system tables. Do NOT try to edit the results in the grid. That would be very very very bad. Just copy & paste the text in the TEXT column.

Oh. Just an FYI. You have to be very careful with your terms in these forums or you may end up with a wrong answer to your questions. What you're running is an extended stored procedure in SQL talk, not a function. Function, in SQL, has a very specific meaning and does NOT return the same types of values as a stored procedure or extended stored procedure.

Hope this helps.


Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
THanks will have a look. Yeah I was talking about the function in the dll but I realise it was worded a bit od. thanks for help.
 
OK did that and all the text bit contains is the physical location of the dll.
 
That might be what your number is pointing to, then. Not the value that comes out of the .dll but the location.

Since memory locations are unique to each box, and a function of the OS, not SQL, I don't know what to tell you. I have no idea how to crack open a .dll and see what it's doing. If you have a copy of the program lying around (the original solution, not the .exe), you might be able to open that up in Visual Studio, but there's nothing else you can do at this point.

Sorry.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top