E-Mail User When StoredProc Fails

Jun 8, 2004

Hi,

I want to e-mail a user when a Stored Proc fails, what is the best way to do this? I was going to create a DTS package or is this too complicated?

Also, the Stored Proc inserts data from one table to another, I would like to use Transactions so that if this fails it rolls back to where it was, I'm not sure of the best way to go about this. Could anyone possibly point me in the right direction? Here's a copy of some of the stored procedure to give an idea of what I am doing:

-- insert data into proper tables with extract date added
INSERT INTO tbl_Surgery
SELECT
SurgeryKey,
GETDATE(),
ClinicianCode,
StartTime,
SessionGroup,
[Description],
SurgeryName,
Deleted,
PremisesKey,
@practiceCode--SUBSTRING(SurgeryKey,PATINDEX('%.%',SurgeryKey)+1, 5)
FROM tbl_SurgeryIn

INSERT INTO tbl_SurgerySlot
SELECT
SurgerySlotKey,
GETDATE(),
SurgeryKey,
Length,
Deleted,
StartTime,
RestrictionDays,
Label,
IsRestricted,
@practiceCode
FROM tbl_SurgerySlotIn

INSERT INTO tbl_Appointment
SELECT
AppointmentKey,
GETDATE(),
SurgerySlotKey,
PatientKey,
Cancelled,
Continuation,
Deleted,
Reason,
DateMade
FROM tbl_AppointmentIn

-- empty input tables
DELETE FROM tbl_SurgeryIn
DELETE FROM tbl_SurgerySlotIn
DELETE FROM tbl_AppointmentIn

Any help would me very much appreciated,

Thanks

View 3 Replies


ADVERTISEMENT

How To Set User Who Can't Modify Any StoredProc And Data In Tables But Can Read Data In Tables And Any StoredProc ?

Jul 13, 2007

Please give me advise ครับ
 

View 1 Replies View Related

Help With Mail That Send Mail When Database Bakcup Fails

Sep 1, 2006

Hello

I have got a script which gives the mail to the dba mail box when database backup fails.

In the script I want to make a change so that I get the particular database name , on what ever database i implement.

Can you tell me some suggestions.

The script I am using is :



use master
go
alter PROCEDURE dbo.SendMail
@to VARCHAR(255),
@subject VARCHAR(255),
@message VARCHAR(8000)
AS
BEGIN
SET NOCOUNT ON;
DECLARE
@rv INT,
@from VARCHAR(64),
@server VARCHAR(255);
SELECT
@from = 'testsql2000@is.depaul.edu',
@server = 'smtp.depaul.edu';


select @message = @message + char(13) + Char(13) + @@servername + '-'+ db_name()+ '-' + 'Backup Status Failed' + Char(13)

EXEC @rv = dbo.xp_smtp_sendmail
@to = @to,
@from = @from,
@message = @message,
@subject = @subject,
@server = @server;
END
GO




--- After the above script is run the following should be given in the 2nd step when
--- the backup jobs are scheduled ------

exec master.dbo.sendmail
@to = 'dvaddi@depaul.edu',
@subject =' Test sqlserver 2000',
@message = '' ;




Thanks

View 4 Replies View Related

Help:SQLExpress User Instance Fails For Normal User; Works For Administrator

Jan 22, 2008

I'm using the RTM version of Visual Studion 2008 and SQLServer Express.

Logged in as an administrator, I can create a connection to an mdf file and all is well.

As a normal user, attempting to create a connection gives the message "sqlservr.exe has stopped working A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available."

I have tried this with UAC turned on and turned off. The result is the same. In Services I can see that SQLEXPRESS is running, but each time I try to connect, I get the "stopped working" message.

For existing database programs that have the .mdf file stored in the project folder, I can run the program in the VS IDE on my XP machine and on my Vista machine as administrator, but not as a normal user.

I'm not looking for a workaround to make this work once, but the cause and solution to the problem. This is for an introductory VB textbook and we must be able to move a database program from one machine to another and make it work. Everything I have read says that SQLExpress should be able to do that.

Can anyone help me with this?

Judy Fraser

View 26 Replies View Related

SQL Mail Fails To Start

Jun 25, 2001

Hi,
My SQL Mail fails to Start. I am using Outlook Express as my mail client. I am not sure why it does not work in one of the servers when it works fine in another SQL Server. Any ideas. Help Appreciated.

Thanks,
Cynthia

View 2 Replies View Related

DTS: Did Not Invoke SQL Mail When DTS Fails

Dec 6, 2000

Hi!

I have developed DTS package for various tasks and scheduled to run some time. I have included SQL Mail task to notify me for each process when it fails. The questions is, When I open the package and execute from the menu, it works and it notifies me through SQL Mail task when it fails but when DTS package invokes at scheduled time and it got failed but it did not notify me that process in between has failed. It seems like SQL Mail task does not work when i schedule the package. Is there any one did come across this situation? or is there any way to resolve this issue? Any help would be appreciated!

Thanks,
Mohana

View 1 Replies View Related

Deploy Fails Telling Me The User Don't Have Permissions, But The User Listed Isn't Me!

Aug 8, 2007

I'm trying to deploy a project that I deployed yesterday just fine, but today I get the following error:


------ Deploy started: Project: Point Reports, Configuration: Debug ------

Deploying to http://reporting.companyname.com/reportserver

Deploying data source '/Data Sources/Srv24.FieldResponse2_1'.

The permissions granted to user 'DOMAINharley.p.bartman' are insufficient for performing this operation.

Deploy complete -- 1 errors, 0 warnings

This seems like a basic permission issue, except I'm not logged in as the user listed! I've never logged into my computer as the user. I did log in to the reporting services website yesterday as that user, but since have rebooted my machine and logged into bothe my computer and the reporting services website as me. Yesterday this report deployed fine. Today, this error message. I've even tried creating a new project and just creating a simple datasource and deploying just that, but still this message! Where is Visual Studio storing and reusing this user name during my deploy process???

View 4 Replies View Related

Database Mail Sends Test Mails Successfully, But Sp_send_dbmail Fails

Apr 15, 2008



Hi all,

I am having a few problems with Database Mail and wondered if anyone could assist. It sends test mails fine, but when I run the following script:

(I've changed my email address in this post to test@test.com they are accurate in the scripts.)


EXEC msdb.dbo.sp_send_dbmail

@profile_name = 'Test Mail',

@recipients = 'test@test.com',

@body = 'Sent by sp_send_dbmail',

@Subject = 'SQL Server Email Test Email';


It gives the following errors.

(from the above script)


mailitem_id = 16
profile_id = 2
recipients = test@test.com
copy_recipients = NULL
blind_copy_recipients = NULL
subject = SQL Server Email Test Email
body = Sent by sp_send_dbmail
body_format = TEXT
importance = NORMAL
sensitivity = NORMAL
file_attachments = NULL
attachment_encoding = MIME
query = NULL
execute_query_database = NULL
attach_query_result_as_file = 0
query_result_header = 1
query_result_width = 256
query_result_separator =
exclude_query_output = 0
append_query_error = 0
send_request_date = 2008-04-15 10:50:03.827
send_request_user = COMPANYTest.Test
sent_account_id = NULL
sent_status = failed
sent_date = 2008-04-15 10:50:04.000
last_mod_date = 2008-04-15 10:50:04.513
last_mod_user = sa


(from the test mail)


mailitem_id = 11
profile_id = 2
recipients = test@test.com
copy_recipients = NULL
blind_copy_recipients = NULL
subject = Database Mail Test
body = This is a test e-mail sent from Database Mail on UKDEVSQL1
body_format = TEXT
importance = NORMAL
sensitivity = NORMAL
file_attachments = NULL
attachment_encoding = MIME
query = NULL
execute_query_database = NULL
attach_query_result_as_file = 0
query_result_header = 1
query_result_width = 256
query_result_separator =
exclude_query_output = 0
append_query_error = 0
send_request_date = 2008-04-15 09:51:46.530
send_request_user = COMPANYTest.Test
sent_account_id = 4
sent_status = sent
sent_date = 2008-04-15 09:51:46.000
last_mod_date = 2008-04-15 09:51:46.610
last_mod_user = sa


sysmail_event_log gives this error for mail item 16 (the scripted email):

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 4 (2008-04-15T10:11:41). Exception Message: Cannot send mails to mail server. (Mailbox unavailable. The server response was: 5.7.1 Requested action not taken: message refused). )

View 2 Replies View Related

Mail The DBA When A Specific User Connects

Feb 20, 2007

Hi,
I want to receive a mail when a specific user connects.
How can this be done best? Raise an alert? How?
Btw, the 'Login auditing' is set to 'Failed logins only'.
Suggestions are very welcome!
Cheers,
E

View 1 Replies View Related

Receive Mail When Specific User Connects

Feb 22, 2007

Hi,
I want to receive a mail when a specific user connects.
How can this be done best? Raise an alert? How?
Btw, the 'Login auditing' is set to 'Failed logins only'.
Suggestions are very welcome!
Cheers,
E

View 1 Replies View Related

DTS Package Fails For Only User

Jan 11, 2008

There is a DTS package that fails to run for one user. The DTS runs for other users. The DTS even runs when the user signs onto another Server.

The error message that the user gets is the following:

The number of failing rows exceeds the maximum specified.
TransformCopy 'DTSTransformation_1' conversion error: Conversion invalid for datatypes on column pair 1 (source column 'F1' (DBTYPE_WSTR), destination column 'PostDt'(DBTYPE_DBTIMESTAMP))

As previously stated, if the user signs onto another Server with SQL Server on it, the DTS performs a successful transformation.

Has anyone seen this error. I've been looking over all roles and security and have not been able to find any differences between user setup.

Thanks in advance.

View 7 Replies View Related

Unable To Send Database Mail To External User

Jul 13, 2015

I have two domains. forest domain abc which has the exchange infrastructure. forest domain xyz which does not have exchange. There is a two way trust set up.

I have set up database mail which sends internally but not externally on the xyz domain its uses mailrelay address to comunicate with exchange. The receive connector is set up correctly on exchange on domain abc as I have managed to send email from a sql server to external contact in the abc domain.

The IP addresses are correct on the receive connector.

The problem is I am unable to send to an external contact from the sql server in the xyz domain. Not sure if this an exchange issue or database mail.

View 2 Replies View Related

E-mail Delivery Report By Trigger Or User Solicitation.

Dec 15, 2006

It's possivel delivery a report after trigger execution ou user solicitation?

Thanks in advance, Rui Figueiredo

View 1 Replies View Related

SQL Server Admin 2014 :: Database Mail Fails At Email Server Alert

Apr 23, 2015

We recently had a problem with DB Mail. SQL jobs that sends an email succeeded but the email in the job fail to sent. There was a problem with the email server. The error is included. We fixed the problem with the email server. How can I get an alert when a DB Mail email fails send?

Date4/23/2015 10:01:06 AM
LogDatabase Mail (Database Mail Log)

Log ID5907
Process ID13204
Mail Item ID5702
Last Modified4/23/2015 10:01:06 AM
Last Modified Bysa

Message
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2015-04-23T10:01:06). Exception Message: Cannot send mails to mail server. (Insufficient system storage. The server response was: 4.3.1 Unable to accept message because the server is out of disk space.).
)

View 2 Replies View Related

SA Login Fails Under Domain User Context

Nov 2, 2015

I have setup a SQL 2014 server with mixed authentication. Below is sequence.

1. Created a server. Added server to a domain & logged out.

2. RDP to the server using a local account. Installed SQL 2014. Kept the services to run using default NT Authority accounts during initial setup. SQL was installed in mixed mode (SQL & windows authentication). a specific 'sa' pwd was set.

3. After initial setup, I changed all SQL services Logon account to be respective domain accounts. Made sure all services restarted, up & running.

Now, for the same 'sa' SQL login account -

--> if I RDP to the server using local system admin & connect to SQL studio with 'sa' (SQL authentication) - it works.
but --> if I RDP to the server using my domain account (which is already an admin on SQL & windows), but connect SQL studio with the Same 'sa' (SQL authentication) - it fails & gives - unable to login 'sa'... ; standard error code : 18456.

Question : How can be the same 'sa' login, is acting different based on with what user context I RDP to the server ?

View 3 Replies View Related

ASP.NET 2.0 Call Of MS SQL DTS Package Fails With Unknown User Name/Password

Feb 20, 2007

I am writing an ASP.NET intranet application on a Windows XP machine running IIS 5.1 which executes a MS SQL Server 2000 DTS package as part of the process. The application allows the user to select a UNC path of an input source (.txt) file to be procesed by the DTS pacakge and the UNC file path property is then set in the source object name of the DTS package tasks before executing the DTS package. Whenever I run the application using a file path that is on my development machine (the same machine that the web server is on) it works fine. When I select a source file path that is on a network share folder, the DTS package fails with the following error:Event Type:      ErrorEvent Source:      DataTransformationServicesEvent Category:      NoneEvent ID:      81Date:            2/14/2007Time:            12:58:06 PMUser:            N/AComputer:      PHILSDELL2Description:The execution of the following DTS Package failed: Error Source: Microsoft Data Transformation Services (DTS) PackageError Description:Package failed because Step 'DTSStep_DTSDataPumpTask_2' failed.Error code: 80040428Error Help File:sqldts80.hlpError Help Context ID:700Package Name: ATMRecon_ImportElanACHTxtPackage Description: (null)Package ID: {3A8CC31D-A81F-40B7-BE57-AEB3AA238088}Package Version: {B01420A7-ED22-49A7-B4C7-9FA1732394E3}Package Execution Lineage: {2A9D45E8-35F8-4F0A-8339-7E5E29DA08B7}Executed On: PHILSDELL2Executed By: webaccess23Execution Started: 2/14/2007 12:58:05 PMExecution Completed: 2/14/2007 12:58:06 PMTotal Execution Time: 1.047 secondsPackage Steps execution information:Step 'DTSStep_DTSExecuteSQLTask_1' succeededStep Execution Started: 2/14/2007 12:58:05 PMStep Execution Completed: 2/14/2007 12:58:05 PMTotal Step Execution Time: 0.047 secondsProgress count in Step: 0Step 'DTSStep_DTSExecuteSQLTask_2' succeededStep Execution Started: 2/14/2007 12:58:05 PMStep Execution Completed: 2/14/2007 12:58:05 PMTotal Step Execution Time: 0.047 secondsProgress count in Step: 0Step 'DTSStep_DTSDataPumpTask_1' failedStep Error Source: Microsoft Data Transformation Services Flat File Rowset ProviderStep Error Description:Error opening datafile: Logon failure: unknown user name or bad password.Step Error code: 80004005Step Error Help File:DTSFFile.hlpStep Error Help Context ID:0Step Execution Started: 2/14/2007 12:58:05 PMStep Execution Completed: 2/14/2007 12:58:06 PMTotal Step Execution Time: 1 secondsProgress count in Step: 0Step 'DTSStep_DTSDataPumpTask_2' failedStep Error Source: Microsoft Data Transformation Services Flat File Rowset ProviderStep Error Description:Error opening datafile: Logon failure: unknown user name or bad password.Step Error code: 80004005Step Error Help File:DTSFFile.hlpStep Error Help Context ID:0Step Execution Started: 2/14/2007 12:58:05 PMStep Execution Completed: 2/14/2007 12:58:05 PMTotal Step Execution Time: 0.031 secondsProgress count in Step: 0 When I check the Security Event Log on the server on which the network share is located, I find the following set of messages repeated multiple times:Event Type:      Failure AuditEvent Source:      SecurityEvent Category:      Account Logon Event ID:      680Date:            2/14/2007Time:            1:02:48 PMUser:            NT AUTHORITYSYSTEMComputer:      FS1ADescription:Logon attempt by:      MICROSOFT_AUTHENTICATION_PACKAGE_V1_0 Logon account:      ASPNET Source Workstation:      PHILSDELL2 Error Code:      0xC000006AEvent Type:      Failure AuditEvent Source:      SecurityEvent Category:      Logon/Logoff Event ID:      529Date:            2/14/2007Time:            1:02:48 PMUser:            NT AUTHORITYSYSTEMComputer:      FS1ADescription:Logon Failure:       Reason:            Unknown user name or bad password       User Name:      ASPNET       Domain:            PHILSDELL2       Logon Type:      3       Logon Process:      NtLmSsp        Authentication Package:      NTLM       Workstation Name:      PHILSDELL2       Caller User Name:      -       Caller Domain:      -       Caller Logon ID:      -       Caller Process ID:      -       Transited Services:      -       Source Network Address:      10.120.4.61       Source Port:      0The problem appears to be that the DTS package is trying to access the input source file using the local ASPNET Id from PHILSDELL2 which does not have authority to the network share.  The ASP.NET application is using impersonation, set up through the web.config file:   <identity        impersonate="True"       userName="registry:HKLMSOFTWARESkylightATMReconidentityASPNET_SETREG,userName"        password="registry:HKLMSOFTWARESkylightATMReconidentityASPNET_SETREG,password"    />The application can sucessfully access the network share under the impersonated id (the application first verifies the existience of the source files before executing the DTS package). I have wracked my brain trying to determine where the ASPNET security context is coming from to no avail.  Can someone shed some light on what security credentials the DTS package is using to access the source files and how to change them?

View 1 Replies View Related

Cannot Open User Default Database, Login Fails

Aug 13, 2006

hi:
I got the problem, which lots of people might encounter before.

In my case, I use login control and sqlexpress to build a login page.
when password & user name were entered. It gave me:
"Cannot open user default database, login fails"

The solution given by msdn is:
SQL Server 2005You can use the sqlcmd utility to change the default database in SQL Server 2005. To do this, follow these steps: 1.Click Start, click Run, type cmd, and then press ENTER. 2.Use one of the following methods, depending on the kind of authentication that the SQL Server login uses: €¢If
the SQL Server login uses Microsoft Windows authentication to connect
to the instance, type the following at the command prompt, and then
press ENTER:sqlcmd €“E -S InstanceName €“d master€¢If
the SQL Server login uses SQL Server authentication to connect to the
instance, type the following at the command prompt, and then press
ENTER: sqlcmd -S InstanceName -d master -U SQLLogin -P PasswordNote InstanceName is a placeholder for the name of the SQL Server 2005 instance to which you are connecting. SQLLogin is a placeholder for the SQL Server login whose default database has been dropped. Password is a placeholder for the SQL Server login password.3.At the sqlcmd prompt, type the following, and then press ENTER: ALTER LOGIN SQLLogin WITH DEFAULT_DATABASE = AvailDBNameNote AvailDBName is a placeholder for the name of the existing database that can be accessed by the SQL Server login in the instance.4.At the sqlcmd prompt, type GO, and then press ENTER.

I wonder what are InstanceName, SQLLogin & AvailDBName. It would be nice if someone can give me a specific example, since I am not sure how to type them in a command line. :)

View 1 Replies View Related

Storedproc (again Sorry)

Feb 4, 2007

I get a execption when i run my code i dont know how to debug sql statements so ya could any one give me adive heres the code  public static int CreateMember(string username, string aspApplicationName)
{
int returnvalue = 0;
DateTime dateCreated = DateTime.Now;

// All users are added to users role upon registration.
Roles.AddUserToRole(username, "Users");

String connectionString = ConfigurationManager.ConnectionStrings["SqlConn"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
SqlCommand command = null;
try
{
conn.Open();
command = new SqlCommand("InsertMember", conn);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new SqlParameter("@AspNetUsername", username));
command.Parameters.Add(new SqlParameter("@AspNetApplicationName", aspApplicationName));
command.Parameters.Add(new SqlParameter("@DateCreated", dateCreated));
SqlParameter sqlParam = command.Parameters.Add("@Id", SqlDbType.Int);
sqlParam.Direction = ParameterDirection.ReturnValue;
command.ExecuteNonQuery();
returnvalue = (int)command.Parameters["@id"].Value;
conn.Close();

}
catch (Exception ex)
{

}
finally
{
if (command != null)
command.Dispose();
if (conn != null)
conn.Dispose();
}
return returnvalue;
}  i get a exception at command.ExecuteNonQuery(); and if i dont do int returnvalue = 0; it says i cant use it cause it hasnt be initialized or something like that ALTER PROCEDURE [dbo].[InsertMember]    @AspNetUsername nvarchar(256),    @AspNetApplicationName nvarchar(256),    @DateCreated smalldatetime = getdateASDECLARE @Id int;SET NOCOUNT ON;INSERTINTO [Members] ([AspNetUsername], [AspNetApplicationName],[DateCreated]) VALUES (@AspNetUsername, @AspNetApplicationName,@DateCreated);SET @Id = @@IDENTITYSELECT  @Id  AS [Id] theres my stored proc any ideas?

View 5 Replies View Related

.net StoredProc

Nov 28, 2005

Hi,

View 7 Replies View Related

Connect Fails: Error 4064, Can Not Open User Default DB

Jul 21, 2005

I just installed SQL Server 2005 CTP (9.00.1116) on Windows Server 2003 with SP1. Then I unzipped DotNetNuke portal site and tried to connect to it with various errors, generally relating to invalid login.

View 3 Replies View Related

BIDS Debug Fails With Login Failed For User Error

Mar 17, 2008

Hi all

I configured my packages to user package configurations, but when i try to debug a package in BIDS in get the following error in the execution results tab :


[Connection manager "XXXXXXXXXX"] Error: An OLE DB error has occurred. Error code: 0x80040E4D. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E4D Description: "Login failed for user 'XXXXXXX'.".


Edit.

Now the degub works but after i deply the package to the sql server the package execution fails and the following is written into sql server errorlog

2008-03-17 15:56:31.71 Logon Error: 18456, Severity: 14, State: 8.
2008-03-17 15:56:31.71 Logon Login failed for user 'XXXXXXX'. [CLIENT: <local machine>]

The state 8 indicates bad password, but it isnt... because logging into sql server with that user and password works.

View 4 Replies View Related

User Credentials Delegation From IIS On WinXP To SQL Server On Win2003SRV Fails

Jan 12, 2007

Problem:

I am trying to create an asp.net website with integrated windows authentication
to access SQL databases. IIS resides on WinXP and SQL Server
on Win2000 SRV. Both are in the same NT Domain. IIS and SQL Server cannot
reside on the same machine and a stand alone web server is
ideal as the website needs to access multiple SQL Servers. IIS is set to
Integrated Windows Authentication. The machine running IIS & the SQL Server
are set to be "trusted for delegation" in active directory. The domain user
accounts that will be accessing the databases are not marked as "Account
is sensitive and cannot be delegated".

The connection string that the web app uses to connect to SQL database is:

"Data Source=PWSSQLT;Integrated Security=SSPI;Initial Catalog=Pace_Master;Persist Security Info=true"

with which the user credentials should be flown to the SQL database.
But instead the delegation fails and results in the following ANONYMOUS authentication failure error:

Login failed for user 'NT AUTHORITYANONYMOUS LOGON'.

Description: An unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and where it originated in the code.

--------------------------------------------------------------------------------------------------------------------

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITYANONYMOUS LOGON'.

Source Error:

// Open the connection, and return it

oConn.Open();
return oConn;


Source File: e:ING eIMSApp_CodeDataAccessConnectionManager.cs

Stack Trace:
[SqlException (0x80131904): Login failed for user 'NT AUTHORITYANONYMOUS LOGON'.]

System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader
dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject,
SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity,
SqlConnectionString connectionOptions, Object providerInfo, String newPassword,
SqlConnection owningObject, Boolean redirectedUserInstance)
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options,
Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)

System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,
DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open()

INGRS.DataAccess.ConnectionManager.GetConnection() in e:ING eIMSApp_CodeDataAccessConnectionManager.cs:
DAActivity.Page_Load(Object sender, EventArgs e) in e:ING eIMSDADAStatusDAActivity.aspx.cs
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)

System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()

System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
_______________
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
---------------------

View 6 Replies View Related

Return XML From SQL StoredProc

Apr 21, 2005

Hallo

I have a normal "Select * from Table" SP that have OUTPUT parameters as well.

Is it possible to obtain the result into a XML format and ALSO obtain the OUTPUT parameters in .Net1.1

Thank you

View 6 Replies View Related

SQL 2012 :: Client Connection Fails But Then User Is Prompted To Select Server

Apr 7, 2015

We have a database residing on a SQL Server 2012 Express system running under Windows Server 2012. I have installed the SQL 2012 Native Client on the user's workstation. I created the System DSN with the required settings and when I test the connection all tests pass. I am able to ping the server as well as connect to it via SQL Server Management Studio.

Now when the user launches the application he is presented with the dialog window as in Screenshot1 (see attached). After clicking on Ok he is next presented with the dialog window where he has to select the SQL server. See attached Screenshot2. The user selects the SQL server from the drop down list and he is then able to access the application and work normally. I cannot understand why this is happening because I have included the correct server instance in the DSN settings i.e. sqlserversqlexpress

Telling the user to select the server himself is not an option for us.

I have checked the settings on the SQL Server. TCP/IP is enabled, remote connections are allowed and there is no firewall blocking. Port 1433 has been set as the default port to use.

View 6 Replies View Related

Tool For Generating StoredProc

Jul 9, 2001

Hi,

I'm using SQL Server 2000 as our back end. I'm finding it bit difficult to write StoredProcs manually to be called from my front end. Is there any good Stored Proc generator tool available?

Thanks,
Harish

View 1 Replies View Related

Execute Xp_cmdshell And Other SA Storedproc

Mar 8, 2004

Hi all,

I have to execute stored procedures containing
xp_cmdshell and certain system storedprocedures in msdb and master
with a user who is not SA.
(i.e iam able to execute stored procedures when i log as sa,
but any other user cannot run them)

Pls tell how to do this, it is quite urgent.

View 1 Replies View Related

Storedproc For Wildcard Search

Mar 24, 2008

Hi someone please help me.

i have a serach page which have 4 textboxes.
passing this textboxes as parameters to storedproc iam searching the value.
filling atleast one textbox should fetch the value.

i have stored proc for searching it using normal column values but i want it do using wildcard search also.

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go



ALTER PROCEDURE [dbo].[search1]
(@val1 varchar(225),
@val2 varchar(50),
@val3 varchar(50),
@val4 varchar(50))
AS
BEGIN

DECLARE @MyTable table (CNo varchar(255))



INSERT @MyTable

Select CNo From customer where
((@val1 IS NULL) or (CNo = @val1)) AND
((@val2 IS NULL) or(LastName = @val2)) AND
((@val3 IS NULL) or(FirstName = @val3)) AND
((@val4 IS NULL) or(PhoneNumber = @val4))



--Now do your two selects

SELECT c.*
FROM customer c
INNER JOIN @MyTable T ON c.CNo = T.CNo
Select r.*
From refunds r
INNER JOIN @MyTable t ON r.CNo = t.CNo
END

I WANT THE SEARCH TO BE DONE FOR WILD CARD CHARACTERS ALSO.

if the user enters lastname s*

using same storedproc can i insert wildcard search.

how can i do that please some one help me.

thanks

renu

View 1 Replies View Related

Problem With Sql2005 Query/storedproc

Oct 2, 2006

I am working on the login portion of my app and am using my own setup for the moment so that I can learn more about how things work.  I have 1 user setup in the db and am using a stored procedure to do the checking for me, here is the stored procedure code:ALTER PROCEDURE dbo.MemberLogin(@MemberName nchar(20),@MemberPassword nchar(15),@BoolLogin bit OUTPUT)ASselect MemberPassword from members where membername = @MemberName and memberpassword = @MemberPassword if @@Rowcount = 0beginselect BoolLogin = 0returnendselect BoolLogin=1/* SET NOCOUNT ON */ RETURNWhen I run my app, I continue to get login failed but no error messages.  Can anybody help?  Here is my vb code:Dim MemberName As StringDim MemberPassword As StringDim BoolLogin As BooleanDim DBConnection As New Data.SqlClient.SqlConnection(MyCONNECTIONSTRING)Dim SelectMembers As New Data.SqlClient.SqlCommand("MemberLogin", DBConnection)SelectMembers.CommandType = Data.CommandType.StoredProcedureMemberName = txtLogin.TextMemberPassword = txtPassword.TextDim SelectMembersParameter As Data.SqlClient.SqlParameter = SelectMembers.CreateParameter'NameSelectMembersParameter.ParameterName = "@MemberName"SelectMembersParameter.Value = MemberNameSelectMembers.Parameters.Add(SelectMembersParameter)'PasswordDim SelectPasswordParameter As Data.SqlClient.SqlParameter = SelectMembers.CreateParameterSelectPasswordParameter.ParameterName = "@MemberPassword"SelectPasswordParameter.Value = MemberPasswordSelectMembers.Parameters.Add(SelectPasswordParameter)Dim SelectReturnParameter As Data.SqlClient.SqlParameter = SelectMembers.CreateParameterSelectReturnParameter.ParameterName = "@BoolLogin"SelectReturnParameter.Value = BoolLoginSelectReturnParameter.Direction = Data.ParameterDirection.OutputSelectMembers.Parameters.Add(SelectReturnParameter)If BoolLogin = False ThenMsgBox("Login Failed")ElseIf BoolLogin = True ThenMsgBox("Login Successful")End IfEnd SubThank you!!!

View 3 Replies View Related

StoredProc Insert Into Composite Key Table

Dec 23, 2005

I have three tables that are important here, a 'Plant' table a 'Spindle' table and a 'PlantSpindle' table. The 'PlantSpindle' is comprised of a PlantID and a SpindleID acting as the Primary Key for the table with no other fields.

I have an aspx page that captures the appropriate data to create an entry in the Spindle table. Depending on the user, I will know which plantID they are associated with via a querystring. In my storedproc I insert the data from the webform into the Spindle table but get stuck when I try to also insert the record into the PlantSpindle table with the PlantID I have retrieved via the querystring and the SpindleID of the spindle record the user just created. Basically, I am having trouble retrieving that SpindleID.

Here is what I have in my storedProc (truncated for brevity).

CREATE PROCEDURE [dbo].[InsertSpindle]
@plantID int,
@spindleID int,
@plantHWG varchar(50),
@spindleNumber varchar(50),
@spindleDateInstalled varchar(50),
@spindleDateRemoved varchar(50),
@spindleDurationMonths float(8),
@spindleBearingDesignNumber int,
@spindleArbor varchar(50),
@spindleFrontSealDesign varchar(50),
@spindleFrontBearing varchar(50),
@spindleRearBearing varchar(50),
@spindleRearSealDesign varchar(50),
@spindleNotes varchar(160)

AS
SET NOCOUNT ON
INSERT INTO Spindle
(plantHWG, spindleNumber, spindleDateInstalled, spindleDateRemoved, spindleDurationMonths,
spindleBearingDesignNumber, spindleArbor, spindleFrontSealDesign, spindleFrontBearing,
spindleRearBearing, spindleRearSealDesign, spindleNotes)
VALUES
(@plantHWG, @spindleNumber, @spindleDateInstalled, @spindleDateRemoved, @spindleDurationMonths,
@spindleBearingDesignNumber, @spindleArbor, @spindleFrontSealDesign, @spindleFrontBearing,
@spindleRearBearing, @spindleRearSealDesign, @spindleNotes)

SET @spindleID = (SELECT @@Identity
FROM Spindle)

INSERT INTO PlantSpindle
(plantID, SpindleID)

VALUES
(@plantID, @SpindleID)

I have guessed at a few different solutions but still come up with Procedure 'InsertSpindle' expects parameter '@spindleID', which was not supplied when I execute the procedure.

Any help would be appreciated! thanks!

View 8 Replies View Related

Aaargh! Storedproc Vs SQL In Gridview Update

Jan 26, 2006

When I attempt to update using a stored procedure I get the error 'Incorrect syntax near sp_upd_Track_1'. The stored procedure looks like the following when modified in SQLServer:
ALTER PROCEDURE [dbo].[sp_upd_CDTrack_1]
(@CDTrackName nvarchar(50),
@CDArtistKey smallint,
@CDTitleKey smallint,
@CDTrackKey smallint)
AS
BEGIN

SET NOCOUNT ON;
UPDATE [Demo1].[dbo].[CDTrack]
SET [CDTrack].[CDTrackName] = @CDTrackName
WHERE [CDTrack].[CDArtistKey] = @CDArtistKey
AND [CDTrack].[CDTitleKey] = @CDTitleKey
AND [CDTrack].[CDTrackKey] = @CDTrackKey
END
But when I use the following SQL coded in the gridview updatecommand it works:
        "UPDATE [Demo1].[dbo].[CDTrack]
   SET [CDTrack].[CDTrackName] = @CDTrackName
 WHERE [CDTrack].[CDArtistKey] = @CDArtistKey
   AND [CDTrack].[CDTitleKey]  = @CDTitleKey
   AND [CDTrack].[CDTrackKey]  = @CDTrackKey"
Whats the difference? The storedproc executes ok in sql server and I guess that as the SQL version works all of my databinds are correct. Any ideas, thanks, James.
 

View 2 Replies View Related

How To Get A Recordset In ASP From StoredProc Using Temp Tables ?

Mar 2, 2000

Hi!

The problem that I'm dealing with is that I can't get recordset from SP, where I first create a temporary table, then fill this table and return recordset from this temporary table. My StoredProcedure looks like:

CREATE PROCEDURE MySP
AS
CREATE TABLE #TABLE_TEMP ([BLA] [char] (50) NOT NULL)
INSERT INTO #TABLE_TEMP SELECT bla FROM ……
SELECT * FROM #TABLE_TEMP


When I call this SP from my ASP page, the recordset is CLOSED (!!!!) after I open it using the below statements:

Set Conn = Server.CreateObject("ADODB.Connection")
Baza.CursorLocation = 3
Baza.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=IGOR;Data Source=POP"


Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "MySP", Conn, , ,adCmdStoredProc

if rs.State = adStateClosed then
response.Write "RecordSet is closed !!!! " ‘I ALLWAY GET THIS !!!!
else
if not(rs.EOF) then
rs.MoveFirst
while not(rs.EOF)
Response.Write rs ("BLA") & " 1 <br>"
rs.MoveNext
wend
end if

end if

Conn.Close


Do you have any idea how to keep this recordset from closing?
Thanks Igor

View 2 Replies View Related

Oracle StoredProc/Job Running At SQL Server?

Feb 5, 2003

Hi,
Is it possible Oracle Stored Proc or Jobs able to schedule in sql job?.
Thanks,
Ravi

View 3 Replies View Related

Testing StoredProc With GUID Parameter

Apr 11, 2002

I am working revising a number of stored procs on a system which has suffered some schema changes.

Sometimes I can test my SP code passing in a guid without a problem. Example below:

Test Command:

EXEC usp_Unit_INSERT
'{74A1BABA-0B76-4436-B6AA-01716B686044}', --unitguid
'36', --91', --UnitNumber (varchar)
10, -- xxHospitalNumber
'testUnknown' --UnitName

Above works fine.

I am testing another similar stored proc and am getting this error:

Server: Msg 8152, Level 16, State 9, Procedure usp_Patient_Info_INSERT, Line 24
String or binary data would be truncated.
The statement has been terminated.

(Line 24 performs an insert to a GUID)

Pertient code portions below.
Can anybody shed any light. I am essentially doing nearly identical things to another Stored Proc which works just fine.

Code below fails with above error, but is virtually identical in how it treats all GUID fields to another which does work fine.

-------------------------------------------------
CREATE PROCEDURE [usp_Patient_Info_INSERT]
@PatientGUID varchar(40),--uniqueidentifier,
@PersonGUIDvarchar(40),--uniqueidentifier ,
@CaseNumberdecimal(10,0),
<< and so forth >>

AS
IF @PatientGUID Is Null
SET @PatientGUID =cast( (newid()) as varchar(40))

INSERT INTO [Patient_Info] (
PatientGUID,
PersonGUID,
CaseNumber,
<< and so forth >>

Values (
cast( @PatientGUID as uniqueidentifier),
cast( @PersonGUID as uniqueidentifier),
@CaseNumber,

<< and so forth >>

View 1 Replies View Related







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