RE: Problem with profiling datetime
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Mon, 3 Apr 2006 22:16:28 +0000 (UTC)
Martin Masse (MartinMasse@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
I will add a sample....since my initial post is not that clear...
That simple .NET code
SqlCommand cmd = new SqlCommand("select @TestDate");
cmd.Parameters.AddWithValue("@TestDate", DateTime.Now);
cmd.Connection = conn;
DateTime dt = (DateTime) cmd.ExecuteScalar();
The resulting trace log item is as follow
exec sp_executesql N'select @TestDate',N'@TestDate
datetime',@TestDate=''2006-04-02 18:44:22:687''
Wich will fail when analyzed since there is a syntax error in the command
e.g. two single quote at the end and start of the date.
Please help!
I don't really have a suggestion how to work around this, as I have not
worked much with the DTA.
However, it is obviously a bug somewhere, although I can't tell whether
it is in SQL Trace, the Profiler or in SqlClient. Nevertheless I took
the liberty to submit a bug for it on the MSDN Product Feedback Cetnre,
http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?feedbackId=F
DBK48153
What I noticed was that if I changed DateTime.Now to "DateTime.Now",
that is a string, I got the correct output in Profiler.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- Prev by Date: Re: Microsoft Feedback Center: Available?
- Next by Date: RE: View Designer Option
- Previous by thread: Management Studio: Fatal Scripting Error
- Next by thread: Re: CREATE ENDPOINT (Transact-SQL)
- Index(es):
Relevant Pages
|