.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Is there a way to generate the parse tree of an sql statement?

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :

Is there a way for me to generate the parse tree of an sql statement?

Maybe by using some API that connects to the parser that SQL Server
uses or by using some sort of built in function or stored procedure.


I would like to take something like:
select * from foo where id = @theID

And turn it into something like
      <tables />
      <joins />

Its a very rough example but you get the idea.

View Complete Post

More Related Resource Links

dealing with nulls in a Int32.Parse(string) statement

How do I deal with null values in this section it throws errors when they leave the field blank it is a small order form and they don't have too add data to all the fields .   comm.Parameters.Add("@item_9223", System.Data.SqlDbType.Int);                comm.Parameters["@item_9223"].Value = Int32.Parse(txtitem_9223.Text);                comm.Parameters.Add("@item_9129", System.Data.SqlDbType.Int);                comm.Parameters["@item_9129"].Value = Int32.Parse(txtitem_9129.Text);                comm.Parameters.Add("@item_42795", System.Data.SqlDbType.Int);                comm.Parameters["@item_42795"].Value = Int32.Parse(txtitem_42795.Text);                comm.Parameters.Add("@item_30695", System.Data.SqlDbType.Int);                comm.Parameters["@item_30695"].Value = Int3

how to xml Generate Jquery tree View using XMl

i have an xml file how to Generate Tree View<?xml version="1.0"?>  <HD id="Acct" value="Acct">    <SH id="Books" value="Books">      <TRK id="Annual" value="Annual">        <TGT id="ABA.0001" value="ABA.0001">Closure of accounts for 2009-10</TGT>      </TRK>      <TRK id="Monthly" value="Monthly">        <TGT id="ABM.0003" value="ABM.0003">Finalization of expense accounts for Jun</TGT>      </TRK>    </SH>  </HD>  <HD id="Admin" value="Admin">    <SH id="GH" value="GH">      <TRK id="Eqpt" value="Eqpt">        <TGT id="AGE.0001" value="AGE.0001">Shifting of BSNL Landline.</TGT>      </TRK>    </SH>    <SH id="Offc" value="Offc">      <TRK id="Eqpt" valu

generate xml in proper format; select statement


I have 4 tables ex.

dbo.beach --> which has info like
'beach_ID','beach_name', 'beach_description'

dbo.monitoring --> info like

dbo.monitoring_location --> info like

dbo.advisory --> info like

i want output is follwing format
    <Beachidentifier> xxx <Beachidentifier>
           <beach_name> XXX </>
                     <opendate> XXX </>

          <closedate> xxx </>

SSIS 2005 - Dynamically generate create table statement from source



I have a requirement where i had to migrate the table structure and data from ODBC database to SQL Server. I have dynamic source reader that uses sql query from variable to get the data and the next step is to get the create statement and create table and then to insert data. how can i get Create Statement the destination produces and use sql task to create the table and then insert the data using data flow task.

Please suggest



Reflection.Emit. How to generate a simple if statement.


I am trying to generate a simple C# function that takes in an object as a parameter and outputs it through Console.WriteLine.

Something like this:

        public void DesiredMethod(object input) {
            if (input != null) {

I was able to generate similar function but without the IF statement that checks for null. Here is the code:


        private static object GenerateObj() {

            AssemblyBuilder assmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new System.Reflection.AssemblyName() { Name = "MyAssembly" },

            ModuleBuilder moduleBuilder = assmBuilder.DefineDynamicModule("MainModule", true);

            TypeBuilder typeBuilder = moduleBuilder.DefineType("MyType", T

how to stop ScriptTransfer from generate "Create User" "Create Schema" sql statement?



I am using the following code to generate scripts, but no matter how i configure the options, it always generate create user statement




// Connection to Server
        Server srv = new Server(ConfigurationManager.AppSettings["Server"]);

        srv.ConnectionContext.LoginSecure = false;

Generate thumbnails on the fly

There are many posts how to generate thumbnails using ASP.NET. Some good some less. Be sure to get distance from the versions that use Image.GetThumbnailImage method.

Logical- and Visual Tree

Elements of a WPF user interface are hierarchically related. This relation is called the LogicalTree. The template of one element consists of multiple visual elements. This tree is called the VisualTree. WPF differs between those two trees, because for some problems you only need the logical elements and for other problems you want all elements.

Generate Random Numbers

SQL Server has a built-in function that generates a random number, the RAND() mathematical function. The RAND math function returns a random float value from 0 through 1.

Passing Linq Statement between master and content page


I usually work with windows forms, and am just starting to work with ASP.Net, so appologies if this is a dumb question!

I have a master page which has a search button on it. The results of this are built up using a Linq statement and if there are any results, I want to display the results in a contents page.

On the masterpage, I have the following code:

Private _res

    Public Overridable ReadOnly Property SearchRes()
            Return _res
        End Get
    End Property

 Private Sub DoSearch()
   'some code to get a linq result

    If res.Any Then
            _res = res
            Server.Transfer("SearchResults.aspx", True)
            'no results
            LabelNoRes.Visible = True
        End If
 End Sub

On the SearchResults.aspx page I have this code.

Dim m As pxSite = CType(Page.Master, MasterPage)
        If m.SearchRes IsNot Nothing Then
            Label1.Text = "Results found = " & m.SearchRes.Count
        End If

m.searchRes is always nothing. 

What am I doing wrong here?


Generate rss feed with HTTPHandler





I'm looking for link/tutorials/code samples on How to create HttpHandler for generating rss feeds for a website.




ASP.NET Designer - How Do I generate this Design-Time Markup?


I want to generate this:
    <x:MyControl id="a" runat="server">
            <x:MyScript .. />

May i use the collapse and expand feature (like tree menu) in Report ?


HI all,

May i use the collapse and expand feature (like tree menu) at Report iam using the Report viewer  Control for displaying the Report on my Asp.net Page .


I have number records and each record have detail as i clicked or expand the record then details will be shown is it possible with report viewer control 
If any one have experince before please share the ideas.


Best Regards

ReportViewer :: Failed to enable constraints. But my statement is valid!!

  • A
  • n error has occurred during report processing.
      • Exception has been thrown by the target of an invocation.
        • Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    Why do I keep getting this error, even when not using any data on the report. When I run the query in SQL server I get a resultset. However when I try to render the report I get this error.


    Whats wrong with this statement


    Im trying to updated some old ASP pages with some new .net pages and cant seem to get this update statement to work. I need to update the current ASP code below and then once thats working im going to use that same statement in a procedure for all our new .Net pages..

    So can anyone see what im doing wrong by inserting the 2nd column to the update statement?

    strSqual = "update tas set date_completed='" & TransDate & ", trans_id=" & InsertedTransID & "' where date_completed is null and sercontract_id="& strContractID & " and DATEDIFF(dd,task_due_date,'" & strProcDate & "')<=14"


    I am trying to add an extra column to the update, but not sure if the syntax is correct.

    If Statement Issue



    This is very strange to me. I have spent 2hrs looking into this inside out , but dont seem to get it

    I have an if statement that inserts data into the database. But i check to make sure the name is not entered twice. Now when the name is already in the db, then it should insert else put out a message saying its already in the db

    My code works fine except that  when its not in the db, its inserts but still puts out the message that says "Name is already in use" Not sure if am not seeing something. But thought i did bring it to the forum. Here is my code...Pretty simple

    Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click

            Dim objConnection As SqlConnection
            Dim objCommand As SqlCommand
            Dim strSQLQuery1 As String


            ' If there's nothing to Add for then don't search
            ' o/w build our SQL Query and execute it.
            If String.IsNullOrEmpty(txtAdd.Text) Or Leadbank.SelectedValue = "000" Then


    statement cannot appear outside of a method body


    hi all,

      i am posting my vb.net problem .plz tell me how to resolve this :-

    Dim conn As String = ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString
        'Dim mysqlconnection As New SqlConnection(conn)
        'If mysqlconnection.State=ConnectionState.closed Then mysqlconnection.Open();
        'Dim mySqlcommand As New SqlCommand("select CategoryId,CategoryName from Categories", mysqlconnection)
        'Dim mySqlDataAdapter As New SqlDataAdapter(mySqlcommand)
        'Dim mydataSet As New DataSet()

        'if mysqlconnection.State=ConnectionState.closed Then mysqlconnection.Open();

    i m getting 5 errors in this code

    declaration expected in mySqlDataAdapter.Fill method; Gridview1.DataSource=ds; Gridview1.DataBind();

    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend