Forum Replies Created

Viewing 15 posts - 46 through 60 (of 75 total)

  • RE: Optimal way to Join a table based on MIN and MAX Date in it?

    SELECT

    Field1

    FROM a

    JOIN b ON a.Field1 = b.Field1

    JOIN

    (

    SELECT

    Field1,

    MIN(Date) AS MinDate,

    ...

  • RE: Optimal way to Join a table based on MIN and MAX Date in it?

    skailey (7/14/2009)


    I would like to be able to do this without joining on 2 separate sub queries, for example (field1 is primary key):

    select field1

    from a

    inner join b on b.Field1...

  • RE: How to use CASE statement in Procedure

    Greetings,

    If your concern is to not run all of the checks, then you can modify the IF statements as such:

    IF EXISTS(SELECT * FROM MyTable WHERE Checks2 = true) AND @ChecksFlag...

  • RE: How to use CASE statement in Procedure

    Greetings,

    Not sure if you are asking for putting a CASE inside a stored procedure or if you want a single SELECT to use the CASE statement. It sounds like...

  • RE: combine queries

    Greetings,

    Please take a look at the code again, especially in the WHERE clause.

    WHERE

    (

    @OtherAddressDetails = 'member address'

    AND OtherAddressDetails = @OtherAddressDetails

    ...

  • RE: combine queries

    Greetings,

    I had missed that the IF statement was on the variable when considering the 2 statements. So, here is a slightly modified statement from the one I had given...

  • RE: combine queries

    Greetings,

    From what I can see, the address is being selected on 2 opposite checks on the same table. So, either way, you still get the address. If that...

  • RE: EXECUTION PLAN BUG

    Greetings,

    You are correct, the ascii comparison is character by character for higher value. But, his requirement was only that it was greater than 1. In that case, then...

  • RE: EXECUTION PLAN BUG

    Greetings,

    This might not be a way to cause it to process in the correct order, but it would still work.

    SELECT

    field1

    FROM devTable

    WHERE

    ISNUMERIC(field1) = 1

    AND field1...

  • RE: charindex() and substring() functions

    Greetings,

    Here is some code that will first break your name into 3 separate pieces. Then, it will take the 3 pieces and put them back together as needed for...

  • RE: Stored Procedure used for Wild Card Search on Web Form

    2Tall (7/10/2009)


    Users are unable to serach using wild cards on a web form. The stored procedure is as follows:

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    go

    ALTER PROC [dbo].[bsp_intranet_product_search]

    @ProductId ...

  • RE: The USE command and variables

    Greetings Andrew,

    I may be incorrect about this, but I suspect that the EXEC() operates like a batch. So, it is changing your DB focus, but when it finishes, so...

  • RE: Getting all identity values in a batch insert statement.

    Greetings,

    Another option that you might want to try is to fetch the last identity value prior to the batch insert. Then, you can use a T-SQL statement to fetch...

  • RE: Scripts to create AdventureWorks

    Greetings Jason,

    I really doubt that Microsoft will have the scripts handy that you can run to install the database. Your best bet might be if somebody can make a...

  • RE: Conditional Where clause which has 'in' .

    descentflower (7/6/2009)


    Hi,

    i have to select rows from a table based on an 'in' . I will pass a parameter to the procedure which can be ALL, 0...

Viewing 15 posts - 46 through 60 (of 75 total)