Prev: Localization in Crystal Reports
Next: Can be done?
From: Eric on 24 Mar 2010 07:52 Hi, If I construct a new Select command I use parameters to fill in the data i want to query for. Sometimes I make mistakes and I would then like to check the text directly on the sql server. Before I started using parameters I could just copy the commandtext to the server and see what happens, but if I do that now, I see the parameters, not their values. How can I see the commandtext as it is executed by the server? i.e. mycmd = new commandtext("Select * from Table1 Where user = @user",connection") mycmd.parameters.add("@user",varchar,25).value = "myself" I would like to see: "Select * from Table1 Where user = 'myself'" Is this possible? rg. Eric
From: Armin Zingler on 24 Mar 2010 08:15 Am 24.03.2010 12:52, schrieb Eric: > Hi, > > If I construct a new Select command I use parameters to fill in the data i > want to query for. > > Sometimes I make mistakes and I would then like to check the text directly > on the sql server. Before I started using parameters I could just copy the > commandtext to the server and see what happens, but if I do that now, I see > the parameters, not their values. > > How can I see the commandtext as it is executed by the server? A very good question that I've also asked some years ago. (and in advance: I still don't have a solution) I couldn't imagine that I, as a programmer, am not able to see the SQL I'm sending myself to the database. For example, I wanted to log them in a file. Logging the parameterized query and the parameters seperately was and is not satisfying. In addition, I was trying to quickly find out the format of some values (date format etc) so that I could use it in queries inside Sql Server Management Studio, probably just like you. I was told to enable SQL logging in the DBMS. I still think this is looking at the wrong end, but once again I seemed to be the only one that complained - til now. ;) -- Armin
From: Mark Hurd on 29 Mar 2010 00:15 "Armin Zingler" <az.nospam(a)freenet.de> wrote in message news:OaXwJw0yKHA.2644(a)TK2MSFTNGP04.phx.gbl... > Am 24.03.2010 12:52, schrieb Eric: <snip> >> How can I see the commandtext as it is executed by the server? > > A very good question that I've also asked some years ago. (and in > advance: > I still don't have a solution) I couldn't imagine that I, as a > programmer, > am not able to see the SQL I'm sending myself to the database. For > example, > I wanted to log them in a file. Logging the parameterized query and > the > parameters seperately was and is not satisfying. In addition, I was > trying > to quickly find out the format of some values (date format etc) so > that > I could use it in queries inside Sql Server Management Studio, > probably > just like you. > > I was told to enable SQL logging in the DBMS. I still think this is > looking > at the wrong end, but once again I seemed to be the only one that > complained > - til now. ;) I think part of the problem is that the provider can decide to use parameterisation to pass the base query once and then pass just the parameters to the DBMS for each query. What we want is a "debug mode" for the provider (or a different provider) that does just pass unparameterised SQL each time, and then it might as well make the final SQL available through a read only parameter. -- Regards, Mark Hurd, B.Sc.(Ma.) (Hons.)
From: Cor Ligthert[MVP] on 29 Mar 2010 03:46 Eric, Why inventing that wheel again with squares instead of a rounds. In my gives SQL profiler you back all the information you ask about? http://msdn.microsoft.com/en-us/library/ms187929.aspx Cor "Eric" <Eric(a)discussions.microsoft.com> wrote in message news:9CCB41F7-85DD-4E83-BD11-FCB445BADE3F(a)microsoft.com... > Hi, > > If I construct a new Select command I use parameters to fill in the data i > want to query for. > > Sometimes I make mistakes and I would then like to check the text directly > on the sql server. Before I started using parameters I could just copy the > commandtext to the server and see what happens, but if I do that now, I > see > the parameters, not their values. > > How can I see the commandtext as it is executed by the server? > > i.e. > > mycmd = new commandtext("Select * from Table1 Where user = > @user",connection") > mycmd.parameters.add("@user",varchar,25).value = "myself" > > I would like to see: "Select * from Table1 Where user = 'myself'" > > Is this possible? > > rg. > Eric >
From: Armin Zingler on 29 Mar 2010 07:22
Am 29.03.2010 09:46, schrieb Cor Ligthert[MVP]: > Eric, > > Why inventing that wheel again with squares instead of a rounds. > > In my gives SQL profiler you back all the information you ask about? > > http://msdn.microsoft.com/en-us/library/ms187929.aspx How to determine the SQL I send to an Access database? I send it but I don't know what I send. -- Armin |