Viewing 15 posts - 3,976 through 3,990 (of 4,080 total)
Hey Paul
As a general reminder, remember that CASE is an expression, much like a function. It returns a value. Your error is that you can't mix an IF...
November 14, 2008 at 4:23 pm
It works fine on my 2005 development box. What does your exec statement look like in the other db you run this proc from?
November 14, 2008 at 10:20 am
OUTPUT works wonderfully for that purpose, although an example in books online used to suggest the opposite. It's very easy to implement. Check out this example:
---------------------------------------------------------------------------
declare...
November 13, 2008 at 11:06 am
UPDATE and INSERT are mutually exclusive operations. You either run an update OR an insert query. Updates overwrite existing information, and will not produce the...
November 13, 2008 at 9:21 am
That is exactly the problem. If you have a customer 12345 already in your table, you can't insert a second customer with 12345. If you...
November 13, 2008 at 7:25 am
Five different columns that all have a value of 2 would not create the problem. Five different rows that all have a value of 2 in the primary...
November 13, 2008 at 7:18 am
Doh! :w00t:
I knew there had to be a better way. What I really like about this approach is that you could use it for...
November 13, 2008 at 7:04 am
OK... I'm assuming you need the result set for subsequent processing, not just generating it for a download. (If that assumption is wrong and all you want to...
November 12, 2008 at 4:58 pm
I think you can get there. Basically you have to write code that creates a dynamic SQL string similar to the one in the example, and then execute...
November 12, 2008 at 4:31 pm
My kneejerk response was BCP, but you're talking about a temporary table. Is the file small enough that you could just copy it briefly to a "permanent" table,...
November 12, 2008 at 4:16 pm
Guys, you're still not addressing his issue. He wants to insert deleted rows back into the same table with a version identifier, using SELECT * because he doesn't...
November 11, 2008 at 10:48 am
Looks good to me. 🙂
I'm deleting my earlier entry to plug in the commas.
November 10, 2008 at 5:30 pm
I don't have an answer for you because I've never had that as a requirement, but I do have a question:
What is supposed to happen if the second application (that...
November 10, 2008 at 5:24 pm
You are correct, it is the existence of a null from your subquery that is causing your query to return no rows. It is easy enough to fix...
November 10, 2008 at 5:03 pm
select invNo,productID
,sum(case when sizeSeq = 1 then quantity else 0 end) as SizeSeq1
,sum(case when sizeSeq = 2 then quantity else 0 end) as SizeSeq2
,sum(case when sizeSeq = 3 then quantity...
November 10, 2008 at 4:06 pm
Viewing 15 posts - 3,976 through 3,990 (of 4,080 total)