Is it possble to automatically call an application when another application makes an INSERT from inside sql server? If its possible - how do I do that?
I have an application that manage an sql srever compact edition database it worked OK until I got the following problem: Only when debuging the application ("Start Debugging" from visual studio). In the first call to an sql server routine I get an exception "Unspecified error [ sqlceqp30.dll ]"
I receive the following error when i call report server web service from an asp.net application:
"The request failed with HTTP status 401: Unauthorized."
Here are the IIS logs on the reporting services server. When i open IE and browse to the web service i provide my user credentials and i can access the web service just fine. However when i call the web service via my asp.net application it looks like my credentials are not being passed??
I use Microsof Visual Studio 2005 to write a c# aplication for my compact device (Dell Axim). I also use Sql Server Compact Edition to handle my database. Everything worked OK but suddenly I get an exception on the first call to fill command of a table in my database (Any table) This exception is happenning only when I debug the application if i run the application without debug everything is workink OK. The exception details are :
System.Data.SqlServerCe.SqlCeException was unhandled Message="Unspecified error [ sqlceqp30.dll ]" HResult=-2147467259 NativeError=25123 Source="SQL Server Compact Edition ADO.NET Data Provider" StackTrace: at System.Data.SqlServerCe.SqlCeConnection.ProcessResults() at System.Data.SqlServerCe.SqlCeConnection.Open() at System.Data.SqlServerCe.SqlCeConnection.Open() at System.Data.Common.DbDataAdapter.QuietOpen() at System.Data.Common.DbDataAdapter.FillInternal() at System.Data.Common.DbDataAdapter.Fill() at System.Data.Common.DbDataAdapter.Fill() at Ness300.NessDBDataSetTableAdapters.UsersTableAdapter.Fill() at Ness300.LoginPanel.DoLogin() at Ness300.LoginPanel.OKButton_Click() at NL300Controls.BmpButton.L300Button_MouseUp() at System.Windows.Forms.Control.OnMouseUp() at System.Windows.Forms.Control.WnProc() at System.Windows.Forms.ContainerControl.WnProc() at System.Windows.Forms.Control._InternalWnProc() at Microsoft.AGL.Forms.EVL.EnterMainLoop() at System.Windows.Forms.Application.Run() at Ness300.Program.Main()
I tried to run the application from the mobile device in order to connect to it doing "Attch to running process" from visual studio. But just running the application on the device with the resgistry value: HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NETCompactFrameworkManaged DebuggerAttachEnabled set to 1 caused the crash when I set it back to 0 everything works fine. It worked for me before I do not know what happened. Is it a security problem ?
Can any one helpi me with this because this problem do not give me a way to debug my application.
I have problem in calling the SP from ASP.NET application @DefApp nvarchar(255)= '' ,@DefBusFunction nvarchar(255)= '' ,@DefImpact nvarchar(255) = '',AS Begin declare @sql nvarchar(4000)declare @whereClause nvarchar(4000)DECLARE @return_value intdeclare @sqlWhere nvarchar(4000) select @sql = 'SELECT DefApp, DefBusFunction, DefImpact FROM Def LEFT JOIN ZFunction ON (def.DefApp = ZFunction.App) AND (Def.DefBusFunction = ZFunction.BusFunction)' if @DefImpact <> '' Set @whereClause = ' where DefImpact ' SET @whereClause = @whereClause + ' = ''' + @DefImpact + '''' set @sqlWhere=@sql + @WhereClauseEXEC @sqlWhereEnd and i am calling this SP from my ASP.net application to fill the SSRS report. I have written code in ASP.NET like: sqlCmd = new SqlCommand("subbusample", conn); sqlCmd.CommandType = CommandType.StoredProcedure;sqlCmd.Parameters.Add(new SqlParameter("@DefImpact", SqlDbType.NVarChar, 255, txtValue3.Text.ToString())); sqlCmd.Parameters.Add(new SqlParameter("@DefBusFunction", SqlDbType.NVarChar, 255, txtValue1.Text.ToString())); sqlCmd.Parameters.Add(new SqlParameter("@DefApp", SqlDbType.NVarChar, 255, txtValue2.Text.ToString())); RptViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote; RptViewer.ServerReport.ReportServerUrl = new System.Uri("http://servername/ReportServer");RptViewer.ShowParameterPrompts = false; RptViewer.ServerReport.ReportPath = "/folder name/Subbu_Sample";
when i execute it, i am not able to fill the report with data.
I have an ODBC/C program and I want to call the stored proceduressp_addlogin and sp_adduser in it. Can someone please provide me withsome sample code showing the best way to do this.
I have a SSIS-Package stored in the SQL Server. This package works fine when i execute it from the SQL Server. But if I try to execute the package from a COM+-Application, nothing happens.
Here is my code snipped:
Public Function ExecutePackage €¦ Dim myPackage As New Package Dim app As New Application Dim pkgResults As DTSExecResult
'----- Execute the package from SQL Server myPackage = app.LoadFromSqlServer("\PackageName", "ServerInstance", Nothing, Nothing, Nothing) pkgResults = myPackage.Execute() €¦
End Function
In a Windows Forms Application I can execute the package with this code snipped succesfully. Therefor I think that the problem is my COM+-Application.
Can you put is a call withing a Data Flow that will call an External Application and pass a parameter to that application IE say a command line app and then take the output and assign it to back to the flow as a "column" or whatever for that row... IE I want to take a value push it to an external app and then the output from that app I want to insert it into another field for that row in the new table I am moving the data to.
Hi,In SQL Books Online in the section on @@Error it gives the followingexample:-- Execute the INSERT statement.INSERT INTO authors(au_id, au_lname, au_fname, phone, address,city, state, zip, contract) values(@au_id,@au_lname,@au_fname,@phone,@address,@city,@state,@zip,@contract)-- Test the error value.IF @@ERROR <> 0BEGIN-- Return 99 to the calling program to indicate failure.PRINT "An error occurred loading the new author information"RETURN(99)ENDELSEBEGIN-- Return 0 to the calling program to indicate success.PRINT "The new author information has been loaded"RETURN(0)ENDGOHow do I access the value returned by the RETURN statement (i.e. 99 or0) in my asp application that called the stored proc.Sometimes rather than just return an integer signifying success orfailure I've seen examples where the id of the newly added item isreturned on success and perhaps -1 if the operation fails. Theseexamples make use of ouput parameters to achieve this. If theoperation succeeds then then the output parameters value is set to thenew id and this is accessed from the calling application.E.g.IF @@ERROR <> 0BEGIN-- Return -1 to the calling program to indicate failure.PRINT "An error occurred loading the new author information"SELECT @MyOuptputParameter = -1ENDELSEBEGIN-- Return id to the calling program to indicate success.PRINT "The new author information has been loaded"SELECT @MyOuptputParameter = @@IDENTITYENDWhy go to this trouble if you can use the RETURN statement?
I'm using an Access2K front end on a SQL Server2K backend.I use Scope_Identity() in a lot of stored procedures to pass thenewwly inserted record's unique ID to the next select statement in thesame stored procedure.What I'm wondering is how I can pass the Scope_Identity back to thecalling application.I'm hoping someone can show me the SP code and the aceess code neededto accomplish the following:I insert a new record in a table with a stored procedure. The SPpasses the uniqueID (Scope_Identity) back to MS Access, then MS Accessuses the uniqueID when calling another function...thanks
I am invoking RS web services to render reports, using Apache Axis to generate stub classes from Reporting Service WSDL.
Please let me know if I can integrate Report Viewer control in the jsp where I am writing the report output. Else do I have to create my own custom tags simulating ReportViewer functionality.
have SQL Server 2005 std edition SP1 installed on Windows 2003 Std edition .Configured Transactional (single Publisher and no clustered environment.) Replication past two months working fine, Now 1.Distrib.exe application err is coming.
Due to which my job is failing (Distributor to Subscriber). Iam attaching thw file. Thanks Sandeep
For some reason, over a server link, the following call to a UDF on a linked server does not work, it seems it is treating the UDF as a table.The same UDF called on the local server works fine.--call/select from functionSELECT MASTERID FROM PAUL.RISK_DB.dbo.FNTRADEFILEPRICE('10/2/2006')error:Server: Msg 170, Level 15, State 31, Line 5Line 5: Incorrect syntax near '('.Thanks.
I was wondering if anyone knows the best way to call a function that is located in database on a different server then the database that is calling the function. Is it possible to do this with out linked servers? I am running SQL Server 2000. Any help in this matter would be greatly appreciated.
I've created a dll that load a SSIS package and execute it. It works perfectly from outside SQL but when I tried to used it from SQL it always give me the same error: The task has failed to load. The contact information for this task is "".
The assembly has been registered as UNSAFE and the error I received it's like it was not able to load the tasks defined inside the package. I've tried with an empty package and it doesn't generate any error.
I've also see in the logging file that the account used for running the package is different from the windows account I've connected to the SQL Server.
Any idea on how assure that the package is run with the correct user to allow the execution of the package successfully from the SQL?
We have created a class lib wrapper that imports the com dll. Upon placing the assembly in sql 2005, both the wrapper Dll and the com dll (probably a converted version) gets placed inside the sql 2005 assembly store. Next a CLR sp references the 2 assemblies above, but within the call to the CLR sp things fail with exception: System.UriFormatException: Invalid URI: The URI is empty The works fine from a windows forms app. What is the methodology to invoke a COM Dll? How far are we from implementing this in SQL CLR
Hi, I have got a simple C# assembly which call a ASP.net web service and executes a webmethod, now i want to call this assembly from sql server 2005 within the sql server function. can any body let me know how to do it. Thanks
I have been stressing with issue for last few days.
I have a stored Procedure ramApplicationAddTest, I can run it through SQL Query Analyser without any problem.
I can call this using JDBC and it works, here is how I make call I make to SP
var con1 = DBDriver.getConnection ("alias:ProclaimConnect"); var stmt = con1.prepareCall( "{call ramApplicationAddTest(?,?,?,?,?)}"); stmt.setString(1,'BuildApp'); stmt.setString(2,'BASwimPool'); stmt.setString(3,'Test Test....'); stmt.setString(4,''); stmt.setFloat(5,0); stmt.execute(); stmt.close(); con1.close();
I also have another SQL 2000 Stored Procedure called RamApplicationAddTest1, I can run this SP also through SQL Query Analyser without any problem.
But when I try to run this using JDBC it, gives me following Exception.
SQLState[ERR-Unexpected]ErrorCode[0]Message[java.lang.NullPointerException at com.hs.form.jdbc.JDBCErrorhandler.isMssqlConnectio nErrorInTx(JDBCErrorHanlder.
An exception 'DatabaseQueryException' has occurred at DatabaseQueryClientWinInetImpl.cpp (291).
var con2 = DBDriver.getConnection ("alias:ProclaimConnect"); var stmt = con2.prepareCall( "{call ramApplicationAddTest1(?,?,?)}"); stmt.setString(1,’BuildApp’); stmt.setString(2,’BASwimPool’); stmt.setString(3,’Test’); stmt.execute(); stmt.close(); con2.close();
I hope somebody can give me some hints to fix this.
I am trying to call an RPC from SQL2KSP3 to Sybase ASE 12.5. SQL2K is on an IBM Intel Server running Win2KSP4, ASE is on an IBM RS6000 w/ AIX 5.2.
I have the ASE server set up as a linked server in SQL 2000, and doing queries is working fine, i.e. I can SELECT * FROM asesrvr.testdb.dbo.tablename and get back all the data in tablename from the testdb database on the ASE server asesrvr.
However, when I try to run an RPC using the same syntax, I get a generic 7212 error (Could not execute procedure 'procname' on remote server 'asesrvr'. I am calling the rpc with DECLARE @output char(1) EXEC asesrvr.testdb.dbo.procname @output output
I'm using Sybase's ASE OLEDB provider; on the Linked Server Properties, I have
General Tab Product name: asesrvr Data source: devprod Provider string: <empty> Location: greyed out Catalog: <empty>
Security Tab One local login, sa, which has impersonate checked as the sa passwords on the two servers are the same (I want to eliminate security as an issue while I try to get this working).
Server Options Tab Collation Compatible: checked Data Access: checked RPC: checked RPC Out: checked Use Remote Collation: unchecked Collation Name: <empty> Connection Timeout: 0 Query Timeout: 0
SQL2K's @@version is Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
Any ideas on how I can troubleshoot this further? It does not appear to be limited to this one procedure (this one only has one output parameter and one line of code, so it's about as simple as it can get for testing purposes). Again, queries work fine, so the linked server itself is connected and working, at least for queries.
Hi All,I have a requirement of calling a Executable from SQL Server.I know we can use -EXEC @result = Master..xp_cmdshell @<command_string>However I want to get the return value (int) from the executable.xp_cmdshell always returns 0 or 1. How can the executable return codesay 99 be obtained in SQL Server?Thanks & Regards,Chandra Mohan
SqlParameter param2 = new SqlParameter("@mult2", SqlDbType.Int);
param2.Value = 6;
SqlParameter param1 = new SqlParameter("@mult1", SqlDbType.Int);
param1.Value = 5;
SqlParameter param3 = new SqlParameter("@result", SqlDbType.Int);
param3.Direction = ParameterDirection.Output;
m_cmd.CommandType = CommandType.StoredProcedure;
m_cmd.Parameters.Add(param1);
m_cmd.Parameters.Add(param2);
m_cmd.Parameters.Add(param3);
m_cmd.ExecuteNonQuery();
This works and param3.Value holds the result value. I also notice that I can supply the parameters in any order, and things work fine.
What I want to know is: can I call the stored procedure with parameters, where I haven't supplied the parameter name, and just rely on the parameter order matching instead?
Hi , I have a question about calling functions in SQl Server 2005.
Let's say that I have created as a dbo a function called Calculations.
If I want to call it from T-SQL I will write Select dbo.Calculations (arguments if any) etc.
My question is If I can skip the "dbo" part. Call the function without using the dbo . Can I do that ? Should I create the function as supervisor ? Does Sql Server has a property or something which will allow me to call the function without using the "dbo." ?
How can I call UDFs on linked servers in SQL Server 2005?
More details:
I have some UDFs on Instance "VAXPServerA" in Database "DB1", for example "getSomething(number)".
It might look like this (for example):
---- CREATE FUNCTION [dbo].[getSomething] ( @theNumber int ) RETURNS int AS BEGIN DECLARE @result int SET @result = theNumber * 5 RETURN @result END ----
I can call this function inside of the DB by typing:
---- SELECT dbo.getSomething(5) ----
I also can call the function from another DB on instance "VAXPServerA" by typing:
---- SELECT DB1.dbo.getSomething(5) ----
I have a second instance called "VAXPServerB", and "VAXPServerA" is a linked server in "VAXPServerB". I can do selects and stuff, it works fine. But when I want to call the function...
Setup: I have a C# 2.0 class library that contains certain business logic that is to be triggered by certain database states. There is a trigger that calls a stored procedure that is working properly (i.e. the stored procedure is being executed). Problem: I have not yet figured out how to call the dll from the stored procedure. Does anybody have any tutorials they could point me to or any advice to point me in the right direction? Thanks in advance for any help.
I am trying to call DB2 stroe procedure from within SQL server 2000 using DTS. I have the IBM odbc driver installed on the server. I have created an ACtiveX script to run in DTS and it fails staing it could not findor load the DB2 store procedure.
Has anyone come across doing this and how they did it?
The linked server was not created When I executed the query. However, I was able to create the linked server when I executed this query(batch 2) alone. Is there any limitation of SP which I am not aware of?
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?
Hi, I am having a problem connecting my .net applications from the application server to the database server. When I run the application from my windows xp (sp2) box it works fine. When I try to connect via SQL Management Studio to the database server from the application server I get the same error. Here is the error: System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) Here is the Environment: App Server: Windows Server 2003 Standard Edition Inside Company's Firewall/ Network Database Server: Windows Server 2000 Advanced Edition SQL Server 2000 SP4 Remote Connections to the Server is checked Enable Protocols: Named Pipes & TCP/IP TCP/IP Port: 1402 (I don't know why it isn't the default of 1433) The db server is sitting out side the Company's firewall (don't ask me why). I can access it fine from inside the firewall on my XP box but not from windows server 2003. There is a web server outside the our network that also connects to the db server with no problem and that is running Windows Server 2003 Web Edition. I can ping the db server from the app server using the IP address. I tried using the IP address and the port 1402 in my connection string but that didn't work from any machine (XP and Server). I imagine the issue is somehow related to the company's firewall but why would it only block Windows Server 2003 and not XP? What do I tell the network admin to change? Any help would be appreciated. Thanks, Oran