Loading ...
Sorry, an error occurred while loading the content.

RE: [SQLQueriesNoCode] Dynamically query to add columns to result table

Expand Messages
  • Aaron Seet
    This example has a strange keyword WHEN which I can t find in the T-SQL help. Actually it s listed in the Reserved keywords document but no dedicated
    Message 1 of 12 , May 2, 2004
    • 0 Attachment
      This example has a strange keyword WHEN which I can't find in the T-SQL
      help. Actually it's listed in the "Reserved keywords" document but no
      dedicated document article to talk about it. Am I missing something???


      Aaron

      ________________________________

      From: Razvan Socol [mailto:rsocol@...]

      b) using the "Dynamic SQL" technique, like the following procedures:
      http://www.sqlservercentral.com/scripts/contributions/936.asp
    • Aaron Seet
      Actually the real scenario is more complicated than that, I only mentioned the main meat of the query :) There re a couple of other tables other than the WO
      Message 2 of 12 , May 2, 2004
      • 0 Attachment
        Actually the real scenario is more complicated than that, I only mentioned
        the main meat of the query :)

        There're a couple of other tables other than the WO table to query for more
        outstanding quantities to fulfill for certain depts. On top of that, there's
        also a request to eliminate any SO row that has all depts qty down to 0.

        I can't show you the actual stored procedure query now because it's stashed
        away on the server in an isolated network environment. It's a rather secure
        environment i work there, and it's difficult to move things in and out. It's
        a real suffocation.

        Anyway, I've basically achieved what I wanted by manipulating at WF.NET and
        ADO.NET level. The DataGrid's tablestyle and columnstyles were eliminated to
        allow display of all columns, for what was previously a strong-typed
        DataSet's DataTable - now schema-free. Once the query was retrieved I have
        an automated code block to check through the table and note which DataRows
        to remove (those with all 0).

        With the above implementation, the only thing that needs to be changed is
        the stored procedure. No recompilation of code. Not the most saavy and
        elegant, but that'll have to do for now since I'm to concentrate on another
        module now.

        regards,
        Aaron
        ________________________________

        From: Max C. Parmenter [mailto:max.parmenter@...]
        Sent: Wednesday, 28 April 2004 15:50
        To: SQLQueriesNoCode@yahoogroups.com
        Subject: RE: [SQLQueriesNoCode] Dynamically query to add columns to result
        table


        Hi Aaron.
        Can you post the query for us to have a look at? Although your explanation
        seems very thorough it always makes life easier if we can see what you're
        working with!
        Cheers
        Max
      • Razvan Socol
        The keyword WHEN is part of the CASE structure. It is documented in Books Online, but if you prefer to read about it in MSDN here is the link:
        Message 3 of 12 , May 2, 2004
        • 0 Attachment
          The keyword "WHEN" is part of the "CASE" structure. It is documented in Books Online, but if you prefer to read about it in MSDN here is the link:
           
          Razvan
        Your message has been successfully submitted and would be delivered to recipients shortly.