Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mtrein
Starting Member
4 Posts |
Posted - 2005-02-04 : 06:18:57
|
Hi,I have a dll written in C. I would like to know if there is a way to access its methods and attributes directly from the sql code. I would like as much detail as possible since I am a total newb at this, but any help at all would be appreciated.Thanks,Marcelo |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-02-04 : 15:06:18
|
Since you are a total newbie, I would take a step back to determine if this is what you really want to do as this is a really bad idea. What is your dll doing?Tara |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2005-02-04 : 15:10:28
|
What Tara said.Calling methods of a DLL in SQL Server can be done, but should be avoided. The reason is if you make a mistake, you can "lock" your SQL server up. It has happened to me, and it wasn't very pleasant.I believe that you'll need a COM DLL to be able to be called by SQL server, so you'll have to tweak your DLL for that as well methinks. I highly suggest finding another way to solve this problem rather than trying to get SQL server to call your DLL.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
|
|
mtrein
Starting Member
4 Posts |
Posted - 2005-02-04 : 17:52:29
|
Thank you for the advice, but no worries here - I am merely a brazilian IT student, and I am simply trying to learn how to do it. The database is also for study purposes, so if I mess it up - no harm done. =c]]I want to be able to access the dll directly from the sql code, without having to write any external code. I know it can be done via an extended stored procedure, but how? What I would really like is some sample sql code of how to access the methods and attributes in my dll.Any help would be appreciated ;c]Thanks,Marcelo |
|
|
MichaelP
Jedi Yak
2489 Posts |
Posted - 2005-02-04 : 18:49:43
|
I'm not sure how to do the Extended Stored Procs, but if you make a COM DLL, you can call it via sp_OACreate. Lookup sp_OACreate in the Books Online.Michael<Yoda>Use the Search page you must. Find the answer you will.</Yoda> |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2005-02-04 : 20:00:55
|
If you have installed the Dev tools with SQL Server you will find example code in the following sub folder of your installation:Samples\ODS\..Also, SQL Server Books Online (SQL BOL) provides a good reference for creating xp's:The following SQL BOL topics should get you started:- Creating Extended Stored Procedures- Extended Stored Procedure Sample: xp_hello |
|
|
mtrein
Starting Member
4 Posts |
Posted - 2005-02-05 : 00:11:01
|
All goodThumbs up =c]]Found what I neededI shall test, now =P |
|
|
|
|
|
|
|