Viewing 15 posts - 811 through 825 (of 1,183 total)
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, '') = ''
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 30, 2007 at 10:15 am
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
...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 30, 2007 at 10:12 am
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...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 30, 2007 at 9:25 am
Yep:D that's how I believe it to be.
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 30, 2007 at 7:54 am
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...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 30, 2007 at 7:22 am
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...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 28, 2007 at 8:40 pm
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...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 26, 2007 at 5:52 pm
Mike is wanting to check the formatting of the date, not necessarily whether its a date or not.
Mike Levan (10/26/2007)
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 26, 2007 at 12:16 pm
you can use
CURRENT_TIMESTAMP
- OR
GETDATE()
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 26, 2007 at 10:52 am
look in BOL under ISNUMERIC()
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 26, 2007 at 9:47 am
Because I'm guessing your issue is here.... [ & 'Week1' & ]
SELECT
[Item] = CASE WHEN [row] IS NULL THEN...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 26, 2007 at 9:12 am
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 ...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 26, 2007 at 8:34 am
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...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 26, 2007 at 7:39 am
Well, in that CASE. No pun intended.... Instead of using a CASE statement, wrap your logic in parentheses.
WHERE
(jomast.ftype = 'I' AND...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 26, 2007 at 7:28 am
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
...
______________________________________________________________________
Personal Motto: Why push the envelope when you can just open it?
If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.
Jason L. SelburgOctober 26, 2007 at 7:11 am
Viewing 15 posts - 811 through 825 (of 1,183 total)