CTE Constant

  • These values are chosen arbitrary by the decision support department depending of the way the butterflies move through the window when it rains...

    So they are randomly chosen from a combo box in some decision support app.

  • josemyj (12/30/2008)


    These values are chosen arbitrary by the decision support department depending of the way the butterflies move through the window when it rains...

    So they are randomly chosen from a combo box in some decision support app.

    Ah, so you are saying that these values are chosen by the user and then need to be passed by the client code to the SQL Server?

    If so, then either the (Select 1 Union All ...) derived table method that you had in your original post, or a similar method where you insert it into a temp table would do:

    Select 1 [val] Into #temp

    Union All Select 25

    Union All Select 33

    ...

    Both are fine.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • josemyj (12/30/2008)


    These values are chosen arbitrary by the decision support department depending of the way the butterflies move through the window when it rains...

    So they are randomly chosen from a combo box in some decision support app.

    In what format does SQL Server get these numbers? Or does somebody have to type them in to a query window in SMS?

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • And for what it's worth: I have used the method that you have in your original post many times and it is faster than any other method that I have ever found, for the situation that I described. (barring network bandwidth issues, problems with the size of a command string and truly enormous lists that should really be using BULK INSERT calls).

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

Viewing 4 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic. Login to reply