Forum Replies Created

Viewing 15 posts - 811 through 825 (of 1,183 total)

  • RE: Why Does This Return NULL?

    Why not use ISNULL instead of NULLIF.

    i.e.

    CREATE PROCEDURE Test

    @employee int = NULL

    AS

    SELECT * FROM Employees

    WHERE EmployeeID = @Employee or ISNULL(@Employee, '') = ''

  • RE: Grouping question

    Using Koji's example with CTEs and converting it to be 2000 compatible.

    This works, but is messy.

    CREATE TABLE #tmp (EmpID INT , LocationID INT , Amount NUMERIC(9,2))

    INSERT #tmp

    ...

  • RE: Why Does This Return NULL?

    Because the '' is being converted to a bit for the comparison in the NULLIF. When you convert a '' to BIT it returns 0, therefore NULLIF returns a NULL...

  • RE: Question in Cursor

    Yep:D that's how I believe it to be.

  • RE: Question in Cursor

    The first loads the initial value into the cursor, this then allows you to check for the existence of a value and loop while one exists. If you didn't initially...

  • RE: SQL query need help!!! urget

    Jeff's right, we're all willing to help someone who's stuck. Unless you show that you've tried, I'm not gonna make it easy for ya. 😀

    Show what you've tried for each...

  • RE: Date

    Mike Levan (10/26/2007)


    13/34/2007 is not a valid date, need to check like this.

    Mike,

    As we've noted here, there is a difference in checking to see if "13/34/2004" is a valid date...

  • RE: Date

    Mike is wanting to check the formatting of the date, not necessarily whether its a date or not.

    Mike Levan (10/26/2007)


    its not the exact date i need to check rather i...

  • RE: Stored Procedure datetime with default of current_date

    you can use

    CURRENT_TIMESTAMP

    - OR

    GETDATE()

  • RE: Varchar

    look in BOL under ISNUMERIC()

  • RE: Whats wrong with my code?

    Because I'm guessing your issue is here.... [ & 'Week1' & ]

    SELECT

    [Item] = CASE WHEN [row] IS NULL THEN...

  • RE: Whats wrong with my code?

    Sorry, I reformatted this so that I could follow it, but what does the following code return in the col field?

    Sample results please?

    SELECT ...

  • RE: Case in Where clause

    Matt Miller (10/26/2007)


    you CAN use a case statement in your where clause, but not in the way you're looking at it.

    Matt, I wasn't saying that you COULDN'T use a...

  • RE: Case in Where clause

    Well, in that CASE. No pun intended.... Instead of using a CASE statement, wrap your logic in parentheses.

    WHERE

    (jomast.ftype = 'I' AND...

  • RE: Case in Where clause

    Your logic seems flawed? You are testing each condition with the same three fields having the same values, and then you compare the fourth to the variable's value ..

    WHERE

    ...

Viewing 15 posts - 811 through 825 (of 1,183 total)