|
Hi,
I have a logger written in T-SQL (Stored Procs) writing to a log table.
When there are exceptions a log row is written, but then when the outer transaction rolls back it also rolls back the log entry.
I would like to have the log entry (i.e. row) to be inserted and persisted regardless of what the outer (nested) transactions are doing. The log entry should never roll back
Could someone point me to a solution using T-SQL?
Thanks
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|
|
Yuval Naveh wrote: I would like to have the log entry (i.e. row) to be inserted and persisted regardless of what the outer (nested) transactions are doing. The log entry should never roll back
Could someone point me to a solution using T-SQL?
You could use a raiserror [^] to write your message to the sys.messages view. You'd have to predefine the errormessages using sp_addmessage though.
Alternatively, if it's from a stored procedure then you might choose to add them to a variable, as opposed to logging them immediately. Next, RETURN that variable when exiting the sproc, and write insert it's contents to the logfile loggingtable.
If you have the option to drop the TSQL-requirement, then go for extended procedures, like xp_cmdshell (executing isql.exe to execute an SQL statement).
I hope someone else comes up with something better
I are Troll
modified on Tuesday, January 19, 2010 7:31 PM
|
|
|
|
|
Hi Eddy,
Using the xp_cmdshell to come back and insert rows is a possibility - looks a bit cumbersome though.
If I can't figure it out a more elegant way this might be a (temporary) solution.
Thanks,
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|
|
|
Hi,
I could not find a specific hint that solves the problem.
Thanks
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|
|
Please guys help me...Can anyone give me some links for
1) INGRES Algorithm
2) System R Algorithm
3) SDD Algorithm
i tried to find out these, but could not get some satisfactory results.
|
|
|
|
|
Muzammil Saeed wrote: Please guys help me...Can anyone give me some links for
I posted some random* links, since you didn't mention whether you wanted explanatory material or reference-implementations.
Muzammil Saeed wrote: 1) INGRES Algorithm
There's the Ingres[^]-database.
Muzammil Saeed wrote: 2) System R Algorithm
An IBM-database[^], never used it personally.
Muzammil Saeed wrote: 3) SDD Algorithm
An example implementation[^].
You're studying databases and the way they work?
I are Troll *) Not entirely random, but rather arbitrary
|
|
|
|
|
I am student and studying Dist. databse. I want these with some example....
|
|
|
|
|
The only examples that I could find[^] are part of a presentation. It seems that osun.org[^] has some good information too, but I didn't dig in deep enough to judge whether it's what you're looking for.
Have you considered turning your research-results into a CodeProject-article?
I are Troll
|
|
|
|
|
SQL Server 2008 has the new 3-byte DATE format that I would like to use, being as I don't need the extra overhead of storing TIME.
I used bcp to generate the following format file from my table definition:
"<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="1" xsi:type="CharTerm" TERMINATOR="\t" MAX_LENGTH="10" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="2" xsi:type="CharTerm" TERMINATOR="\r\n" MAX_LENGTH="11"/>
</RECORD>
<ROW>
<COLUMN SOURCE="1" NAME="Symbol" xsi:type="SQLVARYCHAR"/>
<COLUMN SOURCE="2" NAME="myDate" xsi:type="SQLDATE"/>
</ROW>
</BCPFORMAT>"
xsi:type="SQLDATE" is used to define the transformation for the date in my ascii file to the DATE in the table.
A snippet from the input file is:
AAI 19940101
ACL 19981231
AKA 20091208
BULK INSERT interprets all of these dates to be 1900-01-01, which would be the default value I suppose.
But if I change my input file to:
AAI 1994-01-01
ACL 1998-12-31
AKA 2009-12-08
BULK INSERT inserts the correct date values into my table.
This is peculiar because if I define the table to be SMALLDATETIME instead of DATE and SQLDATETIM4 instead of SQLDATE, then either input file works OK.
It wouldn't be such a big issue for me except that I have thousands of files each with thousands of rows and converting them all before importing is going to be time consuming.
I think this is a bug in SS2008. I tried to report it to Microsoft, but to open a support ticket costs $99
1) Is there a free/simple way to report the bug to Microsoft
2) Is there an updated version of bcp.exe (I can't find one)
3) Is there a workaround that doesn't involve pre-formatting the input
Thanks
Steve
|
|
|
|
|
Gawiz wrote: 1) Is there a free/simple way to report the bug to Microsoft
Microsoft Connect[^]?
Gawiz wrote: 3) Is there a workaround that doesn't involve pre-formatting the input
Converting the results, by importing into the SMALLDATETIME and SQLDATETIM4 types and ALTER ing the columntype afterwards.
I are Troll
|
|
|
|
|
I've written a program using C# that is supposed to access a database. When I try to actually open the connection, I get this exception:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
The database access code is contained in a separate assembly. This same assembly is used in another program (written in VB if that matters) that connects to the same database without any problems at all (on the same machine, with the same user logged in, and using the same connection string).
Why am I getting this exception in one program and not in another?
EDIT ===================
Here are the constructors for both apps:
VB: Dim myClass as new MyClass("abc", "def\geh")
C# MyClass myClass = new MyClass("abc", "def\geh");
The problem is that VB automatically escapes the backlslash, but c# requires @"def\geh" ...
Stupid programmer tricks...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Tuesday, January 19, 2010 2:32 PM
|
|
|
|
|
Maybe some strings not escaped correctly?
|
|
|
|
|
The connection string is identical (it's created in the common assembly, and that was the very first thing I checked).
EDIT ===========
Why was this 1-voted?
modified on Wednesday, January 20, 2010 5:50 AM
|
|
|
|
|
A shot in the dark; perhaps a firewall that's blocking one application, and not the other?
I are Troll
|
|
|
|
|
I wrote both apps from scratch (neither existed before I got here), and as far as I know, there are no application-specific blocks on our internal firewall.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
app.config?
app manifest?
elevation code missing/wrong?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
There is no app.config. There is no manifest (unless vb creates on automagically). There is no elevation code. Authorization is via Windows login
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Out of curiosity, I created a manifest file, but the vb's version uses the defaults that the C# one does, so I don't think that's the issue.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Solved it (see original post for solution)
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
The only possibility is a bad connection string.
|
|
|
|
|
That's what I thought but the connection string for both apps is the same. Solved it (see original post for solution)
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Tuesday, January 19, 2010 2:36 PM
|
|
|
|
|
Hi all I am trying to consume a webservice using TSQL but I am getting a null result
The method URL is http://localhost/SSISWebservice/service1.asmx
The invoked url is http://localhost/SSISWebservice/service1.asmx/HelloWorld
I found two samples and used them on a local web service but both of them did not get result s or generated an error.
thanks
Mohammad Al Hoss
Development To Me Is A Pleasure more than a Job
|
|
|
|
|
Are you using MSXML2.XMLHTTP and TSQL, or are you using a CLR-sproc to read the webservice?
If you're using the XMLHTTP variant, then you might want to check whether OLE-automation is enabled;
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO
Hope this helps
I are Troll
|
|
|
|
|
I've encountered an unusual situation in an import program I wrote. From what I can determine, the root of the problem is that I read data from an Excel spreadsheet (through a data conversion component which changes all data types to DT_STR) into an unconstrained table (no FK's, all columns are varchar(255)). For some reason, on occasion currency values are imported with what I assume is their floating point representation. Confusingly, this doesn't appear to be consistent behaviour in a given file. e.g. 10098.73 -> 10098.73 but 8978.98 -> 8978.9799999999996.
In a second package, the data is imported into a correctly typed table (there's a few lookups etc done along the way too). The type of the currency column is numeric(15,2) but I don't seem to be able to catch the data truncation as it is reported as a data overflow instead and I don't want to ignore the error completely in case e.g. text has been entered instead of a number.
I'm assuming the easier way to go is to figure out why the numbers are occasionally stored as floating point in text - can anyone shed any light?
Failing that, I might just write a SPROC that will truncate the text automatically...!!
It definitely isn't definatley
|
|
|
|