473,473 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Parameterized Query

Is there a way to see the exact SQL being generated from a
parameterized query? I am using this technique but am getting some
strange SQL errors during execution and I would like to see the final
SQL that is being generated.
Jun 27 '08 #1
3 2206
xlar54 wrote:
Is there a way to see the exact SQL being generated from a
parameterized query? I am using this technique but am getting some
strange SQL errors during execution and I would like to see the final
SQL that is being generated.
A parameterized query doesn't generate any other sql, the query is sent
as-is to the database engine along with the parameter values, and the
database engine puts them all together.

In short, unless you're using a database that actually rewrites the sql
with the parameter values verbatim, you won't get what you're asking for.

--
Lasse Vågsæther Karlsen
mailto:la***@vkarlsen.no
http://presentationmode.blogspot.com/
PGP KeyID: 0xBCDEA2E3
Jun 27 '08 #2
Just additional - most database enginers come with a trace/profiler
facility that can be used to see the final SQL statements. This is handy
when the code is auto-generated (LINQ-to-entities for example), but I
agree with the last reply: in this case it sounds like it will be sent
verbatim.

Marc
Jun 27 '08 #3
"xlar54" <sc**********@gmail.comwrote in message
news:cd**********************************@m73g2000 hsh.googlegroups.com...
Is there a way to see the exact SQL being generated from a
parameterized query? I am using this technique but am getting some
strange SQL errors during execution and I would like to see the final
SQL that is being generated.
If you are using Microsoft SQL Server, it includes a tool "SQL Server
Profiler". If you run it, it will let you capture all the SQL that the
server is receiving from the client. You may find it useful to examine the
calls that the client is sending to the server. As others replied before,
you will find out that the parameterized query is sent "as is", along with
the values of the parameters.

Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bill George | last post by:
I have a parameterized query that prompts for Contract#. I call it from a click event on a form where I know the Contract#. How can I pass the Contract# I have in the form to the query so it does...
6
by: shumaker | last post by:
I have a form in an Access Project that displays some records, and based on the displayed records I'd like to output this to an excel file, but I need to write more fields of the record than are...
8
by: deko | last post by:
I'm trying to open a Recordset based on a parameterized query. I'm kind of new to parameterized queries, so I'm sure I'm missing something simple. Set qdfs = db.QueryDefs Set qdf =...
1
by: Jorell | last post by:
Hey everyone, I am currently using Microsofts DataAccess Application block ( SQLHelper ) and what I want to do is use a parameterized query instead of just SQL. I can not use stored procedures,...
1
by: John Bailo | last post by:
In testing it seems like I can only use a parameterized query when the parameters are in a WHERE clause. For example cmd.CommandText = "SELECT * FROM jbtest where testfield1=@tablename ";...
8
by: Roland Hall | last post by:
In Access you use "*" + + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access: ...
1
by: TF | last post by:
This group came through for me last time so here we go again. My page shows paint colors, brand name, product code, etc in a gridview with the background matching the paint color. Several links on...
2
by: mcalex | last post by:
Hi, I'm having trouble trying to populate a list box with data from a parameterized query. If I set the rowsource property to the query name, when the form opens I get the parameter values dialog,...
1
by: AnagJohari | last post by:
I want to know the meaning of @ symbol In parameterized query. apart from this if i write an query like this Delete * From Client Where Id=@Id Can u explain the work Of @Id? its just like a...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.