Friday, March 30, 2012
running a vb.net dll from sql server
overnight processing.
Originally the idea was to schedule a job on the server to run for each
database that needs the processing completed.
Whats the best way to do this?
we are using vs 2003, ms slq server 2000
1) All the code to execute is in a vb.net dll
2) needs to be run against one or more databases
suggestions?There are a number of ways to accomplish this. One method is to wrap your
DLL in a command-line EXE that takes arguments for server, database, etc.
and then schedule a SQL Agent job with a CmdExec step for each database.
Hope this helps.
Dan Guzman
SQL Server MVP
"Claude Hebert" <chebert@.rvmags.com> wrote in message
news:ug8QC2$JGHA.2392@.TK2MSFTNGP09.phx.gbl...
> We have a new application were building which includes a module to preform
> overnight processing.
> Originally the idea was to schedule a job on the server to run for each
> database that needs the processing completed.
> Whats the best way to do this?
> we are using vs 2003, ms slq server 2000
> 1) All the code to execute is in a vb.net dll
> 2) needs to be run against one or more databases
> suggestions?
>|||....my first thought is that the VB.Net app logs in and does its thing.
In the old days, I'd write my dll in VB6 and use an ActiveX DTS or TSQL
sp_OACreate.
HTH
JeffP...
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:uHSQD$$JGHA.3276@.TK2MSFTNGP09.phx.gbl...
> There are a number of ways to accomplish this. One method is to wrap your
> DLL in a command-line EXE that takes arguments for server, database, etc.
> and then schedule a SQL Agent job with a CmdExec step for each database.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Claude Hebert" <chebert@.rvmags.com> wrote in message
> news:ug8QC2$JGHA.2392@.TK2MSFTNGP09.phx.gbl...
>|||What about using rundll32.exe?
--
Andrey Odegov
avodeGOV@.yandex.ru
(remove GOV to respond)|||the best method is to do with
SP_OACreate procedure
steps are :
1. if u r using vb.net dll then make sure the value of Register for COM
Interop value TRUE in Project properties ->Configuration Properties
->Build.
2. add strongname with ur project by sn -k utility.
3. publish ur dll in GAC
4. put ur dll and tlb in system32
5. register ur tlb using regtlibv12 tools
6. in sql server stored procedure create a object of tha dll by using
sp_OACreate.
7.use sp_OAMethod to access methods of that Dll.
8. use sp_OAGetProperty,sp_OASetProperty for getting or setting values.
9. use sp_OADestroy to destroy the object at last.
this is really simple.
if u need example for this then mail me personally at
kissvineet@.yahoo.com
Wednesday, March 7, 2012
Run a query that I have stored in a table cell
This is embarasing.
I'm creating a 500 line query from XML, CSV's, etc. and I can't fingure this out.
I'm building a very complex "SELECT" query and then shoving it into the [Select] column in a SQL 2005 table. I want to call a stored procedure that just "executes" that query and returns the results...
Any help would rock.
Gah, can't believe I didn't get it.
I was trying:
EXECUTE ((SELECT [Select] FROM [Item].[Filters] WHERE FilterID = @.FilterID))
And it needed to be:
DECLARE @.Select VARCHAR(5000)
SET @.Select = (SELECT [Select] FROM [Item].[Filters] WHERE FilterID = @.FilterID)
EXECUTE (@.Select)|||
I dont know if i have interpreted your query correctly but is this what you are looking for:
CREATEPROCEDURE [dbo].[uspMyDynamicQuery]
(
@.ColumnsASVARCHAR(400)--pass the columns in like field1, field2, field3 and etc.
)
AS
SETNOCOUNTON;
DECLARE @.SQLASVARCHAR(4000)
SET @.SQL= N'SELECT '+ @.Columns+ N' FROM tbl'
EXEC(@.SQL)
|||
Thanks for the reply :)
I have it working in the 2nd post. I basically did the same thing you did, but rather than build @.SQL, I just retrieve it.