How To Call A VB Program From A Trigger Of SQL Server

Feb 23, 2004

Hi,





I have a VB program to sit somethere. I like to call that program with passing two parameters from a trigger on the SQL Server. The parameters are the contents of the table which the trigger is created on.





Is there any way to achieve that?





Thanks a lot!





Regards,





Kevin Jin

View 1 Replies


ADVERTISEMENT

T-SQL (SS2K8) :: Trigger To Call A Program To Write Text File Onto A Folder In Server

Apr 29, 2014

I have created a trigger to call a program that is written by our program. The program is basically read the record in the table and write to a text file, then delete the record from the table.

The trigger is a after insert trigger. After we added the trigger, we insert a record to the table. The result is that the record still and did not get deleted. Also, the text file didn't get created either. It seems that it take a long time for the record to be written to the table.

But if we just run the program (a exe file), it can write a text file in the folder and delete the record. the trigger is basically:

USE [Zinter]
GO
/****** Object: Trigger [dbo].[ZinterProcess] Script Date: 04/29/2014 18:34:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

[Code] ....

View 9 Replies View Related

Is Trigger Launched By Program Caller Or SQL Server?

Nov 8, 2007

Hi,
I have a question about sql server trigger. For example, I have a trigger for table insert. The way it works is:
A: my program run the insert query, and wait, then the record is inserted, then the trigger is launched, after the trigger job done, my program then return,
or
B: my porgram run the insert query, and wait, then the record is inserted, then my porgram returns, then the trigger is launched. Basically, my program does not have to wait the trigger job done.
Which way is right? or neither one is right.
The problem we are facing right now is, we need to run a pretty big stored procedure and it takes a long time. I am thinking about move some of them to a trigger job, so our porgram don't have to wait for everything done.
Any inputs are welcome. Thanks.

View 2 Replies View Related

Integration Services :: Call SAP RFC Program From SSIS Package

Sep 30, 2015

How do we connect and get data from SAP database using SSIS 2012/2014.Currently we are extracting data using WebService, and BAPI function call for RFC, but it seems not so much reliable, due to timeout and others. ion providing the link for download of .NET Framework Data Provider for mySAP Business Suite and some sample to invoke and get the data using SSIS.

View 5 Replies View Related

Is It This Job Can Program In Trigger?

May 14, 2008

I've have following table,

tblHIT - this table will reveive record every minutes
Date | Time | Main_ID | Hit
------------------------------------
3/1/2006 | 100 | 200 | 8700
...
...
...
4/14/2008 | 100 | 200 | 4500
4/14/2008 | 100 | 201 | 8700
4/14/2008 | 200 | 200 | 3500
4/14/2008 | 300 | 201 | 7700
...
...

I've also 1 job in SQL Server Agent will execute STORED PROCEDURE and will filter 7 days record before from current date and insert it into tblHIT_7days. tblHIT_7days shown as follow
tblHIT_7days
Date | Time | Main_ID | Hit
------------------------------------
3/7/2008 | 100 | 200 | 8700
...
...
...
4/13/2008 | 100 | 200 | 4500
4/13/2008 | 100 | 201 | 8700
4/13/2008 | 200 | 200 | 3500
4/13/2008 | 300 | 201 | 7700

I've plan to create TRIGGER. This TRIGGER will insert the appropriate record from tblHIT into tblHIT_7days and also delete a appropriate record in tblHIT_7days. This INSERT and DELETE transaction depend on current date.

Is it possible, TRIGGER can do this?

View 6 Replies View Related

Call A DLL Or EXE File From SQL Trigger

Mar 22, 2007

I need some help calling a DLL or EXE from a SQL Trigger.  I have the trigger set up, except I have no clue how to call a DLL or EXE or if it is even possible.  Here is what I have for the Trigger so far: 






-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
CREATE TRIGGER CallProgIfParentID
ON Toc
FOR INSERT
AS
IF ((select ins.[ParentID] FROM inserted ins) = '57660')
-- I want to be able to programmatically change '57660' from an ASPX page
EXEC
-- This is where the call function goes
GO







Another question I have is can a trigger be created programmatically using ASPX pages written in VB.NET in VS2003?

Thank you in advance

View 7 Replies View Related

How To Call TRIGGER In VB.net 2005

Sep 26, 2007

i hav written a trigger in SQLEXPRESS DB but i dnt knw how to call in vb.net 2005...

View 2 Replies View Related

How Can I Call A Dll/exe From My Procedure/trigger

Nov 30, 2007

Hi I am trying to run a dll or exe from a procedure or trigger in the database.

I have tried EXEC master ..xp_cmdshell '\xx empdivConsoleApplication1.exe' and
use master exec dbo.StoredProcedure1

If I run the exe from explorer all is working, but from a trigger or procedure in the database nothing happens only executed successfully.

I loaded the assembly and procedure into the master database



Code Block
CREATE PROCEDURE [dbo].[ClassLibrary3] AS EXTERNAL NAME
[ClassLibrary3].[ClassLibrary3.Class1].[StoredProcedure1]





My C# code:


Code Block
public partial class StoredProcedures
{ [Microsoft.SqlServer.Server.SqlProcedure]

public static void StoredProcedure1()
{ //------first a select to get some data String prosjekter = "";
String connString = @"Data Source=serverOFFICESERVERS;Initial Catalog=WSS_Content;Integrated Security=SSPI";
SqlConnection conn = new SqlConnection(connString);
SqlCommand sqlcmd = new SqlCommand("Select nvarchar3 prosjekt from dbo.AllUserData where tp_listId = @listid", conn);
sqlcmd.Parameters.AddWithValue("@listid", "xxx"); try { conn.Open(); SqlDataReader r = sqlcmd.ExecuteReader();
while (r.Read())
{ prosjekter += "" + r["prosjekt"] + "" + "";
}
r.Close(); conn.Close();
} catch (Exception)
{ conn.Close(); }
//-----write some changes back to a program pocketForm pf = new pocketForm();
try {
pf.LoadFromFile("C:/temp/div/xxx.xpf");
string xmlstring = pf.FormXML;
int id, item, items; id = xmlstring.IndexOf("xxxxx");
item = xmlstring.IndexOf("", id);
items = xmlstring.IndexOf("", item);
xmlstring = xmlstring.Remove(item, items - item);
xmlstring = xmlstring.Insert(item, prosjekter);
pf.FormXML = xmlstring;
pf.StatusModifiedLocally = true;
WebService.Login("http://xxxx.no", "xx", string.Empty, string.Empty);
WebService.Save(pf);
} catch (Exception)
{
}

What am I missing here ? Please answer this as I have tried everything with no success. Regards Ivar

View 5 Replies View Related

Call Sproc From Trigger Question

Jun 18, 2008

Hi. Apologies if this has come up before, I wonder if someone can help.

I want to call a sproc from a trigger, passing in the value of a field from the updated/inserted/deleted row.

It would be like spUpdateUser @UserID = x

where x is the value from one of the columns of updated row.

What is the syntax for this please? TIA

View 8 Replies View Related

Call Webservice From Trigger/stored Proc

Sep 17, 2004

Is it possible to call an external web service from a SQL Server trigger or stored procedure?

View 6 Replies View Related

Context Of Procedure Call That Results In Trigger

May 8, 2008

If an application makes a connection under a given user, performs the following:
- calls a stored procedure which performs an insert,
- the insert causes a trigger to be fired
- the trigger causes a sql statement to execute against a different
database

Questions:
* Does the user who called the procedure, also need permissions to this 2nd database ?
* What security context does this trigger get executed ?


I have a stored procedure that is being called by my .Net application. The user account that makes the connection has execute permission to the procedure. However, the procedure does an insert which causes a trigger to fire. This trigger does a sql statement against a table in a different database, which the user who is calling the procedure, does not have permissions to access. Im getting an exception when I call the procedure, and it basically says there was a permission error with the user accessing this other database.

View 2 Replies View Related

Do Sqlexception Breaks The Functionality Of The Program? (program Flow)

May 23, 2007

why we use sql exceptions ...

what the program will do if we caught that exception .. i need some suggestions ... i got this exception(String or binary data would be truncated.
The statement has been terminated.).. will it affect the functionality of the program...

hiow can i avoid this exception..

View 1 Replies View Related

Can I Return A Value In A Variable From A SSIS Program Back To C# After The SSIS Program Is Run From C#?

May 21, 2007

Can I return a value in a variable from a SSIS program back to C# after the SSIS program is run from C#?

View 1 Replies View Related

Multiple Insert Call For A Table Having Insert Trigger

Mar 1, 2004

Hi

I am trying to use multiple insert for a table T1 to add multiple rows.

Ti has trigger for insert to add or update multiple rows in Table T2.

When I provide multiple insert SQL then only first insert works while rest insert statements does not work

Anybody have any idea about why only one insert works for T1

Thanks

View 10 Replies View Related

Using Sql Server In DB Program

Oct 26, 2006

I am about to build a program that will require the use of DB. In the pass I used Access as my back end, but this time I would like to use Sql Server. I just have a few questions before I begin.

1. After deploying and installing my program, do I need to have sql server installed on users system or can the DB file exist on its own and just use ADO.NET to access the file? (As I done in the pass to access my Access mdb file)

2. If I can deploy a sql file -- can it be done with Sql Server Express?

3. If it can't be done, what db program should I use?

View 3 Replies View Related

Problems With SQL Server 2K And VB Program

Jun 27, 2001

Hi,
My company has recently migrated our Informix database to SQL server 2K. The data is successfully migrated and the client are able to connect to the database. However, when trying to run a VB application to access the data, it keeps on prompting for SQL server login whenever an sql statement is executed. What could be the problem? We are using SQL server 2k on Windows 2000 and on the client Windows 95. Thanks!

View 2 Replies View Related

How To Run A Vb.net Program From SQL Server 2005?

Mar 15, 2008

Hi. First 3 paragraphs are about problem in general - this is for those who consider them well experienced and may have better ideas about how to solve this whole thing. In forth paragraph is the tehnical question.



Hi. First 3 paragraphs are about problem in general - this is for those who consider them well experienced and may have better ideas about how to solve this whole thing. In forth paragraph is the tehnical question.

Situation:
So me was trying to find out why files are saved in database incorrectly. First idea was to create a MD5 checksum of a file in my application and then create one with SQL script that saves data in database (data being the file, by the way).

On software side it worked fine 'cuz i'm developing in Visual Basic .NET 2005 which has a function that return a 32 byte array of hash from a data that you pass to it (like file) - GREAT!

SQL Server 2005 side - not so great. The only function that I have found so far that creates hash is HashBytes that is supposed to do it's job only there's a limintation to data size which means i cant make hash of say 4mb big file.

Problem:
So I figure maybe i could create a vb.net program that return a hash from a data passed to it and call it with SQL script (because hashbytes function doesnt work for me in case you didnt read the first 3 paragraphs)... but I don't know how:(
Any ideas?

View 4 Replies View Related

How To Run A Vb.net Program From SQL Server 2005?

Mar 15, 2008

Hi. First 3 paragraphs are about problem in general - this is for those who consider them well experienced and may have better ideas about how to solve this whole thing. In forth paragraph is the tehnical question.

Situation:
So me was trying to find out why files are saved in database incorrectly. First idea was to create a MD5 checksum of a file in my application and then create one with SQL script that saves data in database (data being the file, by the way).

On software side it worked fine 'cuz i'm developing in Visual Basic .NET 2005 which has a function that return a 32 byte array of hash from a data that you pass to it (like file) - GREAT!

SQL Server 2005 side - not so great. The only function that I have found so far that creates hash is HashBytes that is supposed to do it's job only there's a limintation to data size which means i cant make hash of say 4mb big file.

Problem:
So I figure maybe i could create a vb.net program that return a hash from a data passed to it and call it with SQL script (because hashbytes function doesnt work for me in case you didnt read the first 3 paragraphs)... but I don't know how
Any ideas?

View 14 Replies View Related

SQL Server Cannot Install Files To The Compressed Or Encryted Folder: C:program Filesmicrosoft SQL Server

Mar 5, 2007

Where do I go in my computer to correct this problem so that I can complete the installation?

View 3 Replies View Related

Sql Server Bulk Copy Program

Aug 1, 2000

Hi,

I am working on sql server bulk copy program. I am getting data files from
our vendors for shares and stocks. The data files are pipe separated values.
for ex the Ascii file format is

8388182|"ACC consultanats"|"rating for the current financial year"|23

My doubt is i have four columns in my sql server table named stocks.

table structure
---------------
serialno numeric
caption nvarchar(255)
memo1 ntext 16
sno int

In this the third column named memo1 in the data file would be a large
volume data. That is it may be upto one full A4 size page.
One important thing is, data in the third column is not formatted.

Since it is very urgent, let me know what would be the format file for
this type of data file and the bulk copy program utility.

Kindly let me know as early as possible.

Regards
Sivaramakrishnan

View 1 Replies View Related

SQL Server Search-and-replace Program

Apr 21, 2006

I found a search-and-replace program for SQL server that works GREAT, but I have a list of about 200 words to search for, with corresponding replacements. Rather than editing the code below for *each* word and running it 200 separate times, I'd like to iterate through the list, but my MS-SQL programming skills are...light (to say the least). Anyone have any ideas how I can create a list or hash-type variable and use the code to loop through and do the replacements all at once?

/*
*
* Search & Replace
*
* Use Ctrl+Shift+M to replace template values
*
*/

set xact_abort on
begin tran

declare @otxt varchar(1000)
set @otxt = '<string1, text, text to be replaced>'

declare @ntxt varchar(1000)
set @ntxt = '<string2, text, replacing text>'

declare @txtlen int
set @txtlen = len(@otxt)

declare @ptr binary(16)
declare @pos int
declare @id int

declare curs cursor local fast_forward
for
select
id,
textptr(<field_name, sysname, target text field>),
charindex(@otxt, <field_name, sysname, target text field>)-1
from
<table_name, sysname, target table>
where
<field_name, sysname, target text field>
like
'%' + @otxt +'%'

open curs

fetch next from curs into @id, @ptr, @pos

while @@fetch_status = 0
begin
print 'Text found in row id=' + cast(@id as varchar) + ' at pos=' + cast(@pos as varchar)

updatetext <table_name, sysname, target table> .<field_name, sysname, target text field> @ptr @pos @txtlen @ntxt

fetch next from curs into @id, @ptr, @pos
end

close curs
deallocate curs

commit tran

View 1 Replies View Related

VB Program Connecting To Remote SQL Server

Sep 25, 2007



Hi,

I've written a piece of database software in Visual Basic (Visual Studio 2005) to use in my office. My office has networked computers all connected to a server (windows server 2003). I have an old-ish version of SQL server on the server computer (version 7). The software works perfectly within the office environment - each computer on the network connects to the SQL server on the server computer and works very efficiently.

I now want to be able to access the database from home by running the software on my home PC. I want the software to somehow connect to SQL server in the office over the internet. Having read many of the threads about remote SQL server connections, I feel totally out of my depth. I vaguely understand that SQL server needs to be somehow configured to receive connections from the 'outside world'. I don't know how to do this. I also don't know what I need to do on the Windows server to allow this to work. I thought I might be able to use the computer's IP address in the connection string, but using IPconfig on the server I only get network IP addresses - the server may be behind a router... How do I get the proper internet address? Once I've set up the server side to work with remote connections, how do I get my software to communicate with that server? Do I just need to change the connection string and that's it? What would the format of the connection string be?

I'm very sorry for asking so many questions in one go! I have ended up a bit frustrated after reading many threads and articles about SQL remote connections - it's all rather advanced and don't understand most of it!

Thank you very much in advance for any help you can provide.

Sam

View 1 Replies View Related

Sql Express On Server 2003 And Vb6 Program

Jun 15, 2006

I have a vb6 program running fine on a domain on SBS 2003 with the backend connected to sql express. I have added a third computer to the domain and I am unable to run the program on the third computer. I am almost certain that it is not a user, login, or role issue. I would appreciate ideas on how to localize this problem.

Thank you

View 5 Replies View Related

Connecting To SQL Server 2000 Via VB6 Program On Vista

Jul 18, 2007

I am having difficulty connecting to SQL Server 2000 on one of ourservers via a VB6 program on Vista. I can connect fine to a differentserver, but it gives me the following error with the server inquestion:"Unable to connect to database. Please check your internet connectionError# -2147467259[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist oraccess denied"Using the program, I am able to access the database just fine whilerunning on Windows XP, but when I run the program on Vista, it givesme that error message for that server. If I change the connectionstring to a different server address, it works fine on Vista. Whatdifferences in the servers might cause this?Here is my connection string:"driver={SQL Server};Server=ipaddress;Uid=userID;Pwd=pwd;databa se=db"

View 7 Replies View Related

Where Is The SQL Server License Setup Utility Program?

Jul 20, 2005

I am looking for the SQL Server 2000 Licensing Setup Utility Programand cannot find it. Everything I read says, goto ControlPanel->Administrative Tools->SQL Server License Utility. When I gothere, I do not see... Any help would be Greatly appreciated!Setup:Win 2000 ServerSQL Server 2000 Standard Edition Svc Pk 3.Thanks.

View 2 Replies View Related

My Program Uses A Database. Does The End-user Have To Have SQL Server 2005?

Apr 1, 2007

My program uses a database. Does the end-user have to have SQL server 2005?

It uses it to keep track of members so the database is in the installation folder and does not need to be accessed remotely



http://i130.photobucket.com/albums/p247/tarkster2/screen.gif

the above shows this error on another persons computer. they do not have sql server.

View 3 Replies View Related

Being Able To Stop Parallelism In A C++ Program Calling SQL Server

May 7, 2007

Hi All,

I have written ETL software that runs on SQL Server. We are running it for the first time on a 4cpu (2 x dual core) machine on sql server 2005.



One of the things this software does is perform a 'select * from tablename' to validate that the tables passed to it as parameters exist. This has worked fine on previous releases and on single cpu machines because what the optimiser decides to do is to return just the first page of data and then fetch more. I guess it even works in 2005 standard edition.



However, 2005 enterprise edition allows parallelism. And what the optimiser is deciding to do with such a query is to parallelise it and fetch all rows and then give the result back to the program. So, instead of seeing a fraction of a second to return the first page of data we are seeing up to 90 seconds and the database goes and fetches 15M rows in parallel.



Obviously, what we would like to do is to somehow tell the optimiser that this set of programs should not perform any parallel queries. Or, we would like to turn parallelism off on the specific tables we are dealing with for the period of running these ETL programs....they have no need of parallel processing at the database level for virtually all the calls that are performed.



Would someone please be so kind as to advise us if we can do something like pass a parameter to ODBC to stop parallelism or if we can issue commands against specific tables to stop parallelism for a period and then turn it back on?



Thanks in Advance.



Peter Nolan

www.peternolan.com

View 4 Replies View Related

How To Write Batch Program In SQL Server 2005?

Sep 10, 2007



Hello All,
I want to write Batch Program which will insert Data into Table every day based on some conditions.
can anyone please let me know how to write Batch Process in SQL server 2005??
Thanks.

View 5 Replies View Related

I Just Want One Entry For Each Call, With SLA Status 'Breach' If Any Of The Stages For The Call Were Out Of SLA.

Mar 19, 2008

Hi,

I am producing a php report using SQL queries to show the SLA status of our calls. Each call has response, fix & completion targets. If any of these targets are breached, the whole SLA status is set as 'Breach'.

The results table should look like the one below:





CallRef.

Description

Severity



ProblemRef

Logged
Date

Call
Status

SLA Status



C0001

Approval for PO€™s not received

2



DGE0014

05-01-06 14:48

Resolved

Breach


C0002

PO€™s not published

2



DGE0014

06-01-06 10:21

Resolved

OK


C0003

Approval for PO€™s not received from Siebel.

2



n/a

05-01-06 14:48

Investigating

OK



















Whereas I can pick the results for the first 6 columns from my Select query, the 'SLA Status' column requires the following calculation:

if (due_date < completed_date)
{ sla_status = 'OK';
}
else sla_status = 'Breach';

The Select statement in my query is looking like this...

Select Distinct CallRef, Description, Severity, ProblemRef, Logdate, Status, Due_date, Completed_date;

The problem is that my query is returning multiple entries for each stage of the call (see below), whereas I just want one entry for each call, with SLA status 'Breach' if any of the stages for the call were out of SLA.






CallRef.

Description

Severity



ProblemRef

Logged
Date

Call
Status

SLA Status



C0001

Approval for PO€™s not received

2



DGE0014

05-01-06 14:48

Resolved

Breach


C0001

Approval for PO€™s not received

2



DGE0014

05-01-06 14:48

Resolved

OK


C0001

Approval for PO€™s not received

2



DGE0014

05-01-06 14:48

Resolved

Breach



















Any help will be much much appreciated, this issue has been bothering me for some time now!!!




View 7 Replies View Related

Sql Server 2000 And Program Connection String Problem

Nov 4, 2005

Hi,My situation follows:  I set up a database called TempDB and a test connection to it that works on my machine.In my database class I am trying to create a connection by doing the following:
connToLookUpData.ConnectionString = "Integrated Security=SSPI;Initial Catalog=dbTest;Data Source=testServer;"
but I am getting the following error:  Login failed for user "Joe/ASPNET"i have windows XP OS.I based the connection string on the properties of my connection to Database 'Test'.Joe is the name of my computer.   Both the application and SQL Server are now on my local machine.What am I doing wrong?  any help greatly appreciated.Thanks much,Joe

View 2 Replies View Related

How Can I Insert Date In SQL Server 2000 Database (table )from ASP.NET 1.1. Program??

Feb 1, 2006

hi ALL !!!
How can I insert Date in SQL Server 2000 database(table ) from ASP.NET 1.1. Program??
pls send me code if u can
pls help me ..

View 2 Replies View Related

How To Deny Access To Sql Server 2005 Database Except One Special Program

Nov 2, 2007


We want to deny access to sql server 2005 database by the sql management studio or any other sql editor while our developed application can access the database even malicious user gets the login name and password by disassembling our code

View 1 Replies View Related

Do I Need CAL For A Customized Program Connect To SQL Server 2005 Express Edition?

Dec 27, 2005

Hi all,

I am developing a program to connect to SQL 2005 Express. I don't know if I need any CAL license in order to make the connection. If it is not necessary for the Express Edition case, how about if my client upgrate to SQL 2005 in the future? Do I need CAL license for SQL 2005?

Thanks for any advice given.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved