Viewing 15 posts - 2,866 through 2,880 (of 4,087 total)
You might try using an INSTEAD OF trigger instead. I've never used them, so I don't I can't really give you much more info about them.
Drew
November 19, 2015 at 1:46 pm
I actually tried to create a test on SQL 2012 (don't have SQL 2014 available) and when I tried to create the unique constraint, it failed saying that it had...
November 19, 2015 at 10:26 am
Jason A. Long (11/19/2015)
drew.allen (11/19/2015)
Jason A. Long (11/19/2015)
drew.allen (11/19/2015)
November 19, 2015 at 9:46 am
This is not a problem with FIRST_VALUE, only LAST_VALUE. If you do not specify a window, it defaults to RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW. For FIRST_VALUE,...
November 19, 2015 at 8:59 am
Jason A. Long (11/19/2015)
drew.allen (11/19/2015)
November 19, 2015 at 8:41 am
The inclusion of the effective date in your key indicates that TableA is tracking some entity over time. If this is the case, then the entity will be in...
November 19, 2015 at 8:06 am
Piet's on the right track. Try the following:
SELECT
i.AccountID AS [ProductID1],
MAX(o.AccountID) AS [ProductID2],
MAX(a.AccountID) AS [ProductID3]
FROM [Product1] i
LEFT OUTER JOIN [Product2] o
ON i.ProductAccountID = o.AccountID
LEFT OUTER JOIN [Product3] a
ON i.ProductAccountID = a.AccountID
GROUP...
November 18, 2015 at 12:00 pm
Your data doesn't cover all possible cases, so it's not clear which approach to use. What do you want to happen with the following data:
Product1Product2Product3
35NULLNULL
35NULL290
35NULL300
35450NULL
35500350
35659NULL
14NULLNULL
14NULL296
40 NULL NULL
Drew
November 18, 2015 at 10:40 am
Michael L John (11/16/2015)
For starters, you cannot use a case statement in a where clause in this manner.
More specifically, CASE statements cannot return Boolean values, because SQL...
November 18, 2015 at 8:57 am
You can only delete from one table at a time. You can use a temp table to store the ids that you want to delete. You may also...
November 17, 2015 at 2:09 pm
Try the following:
SELECT client_id, office_id, start_year, start_month, start_day, sub_order_number, item_id
, LAST_VALUE(sub_order_guid)
OVER(
PARTITION BY client_id, office_id, start_year, start_month, start_day, sub_order_number
ORDER BY amount, sub_order_number
ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING
) AS order_guid
FROM...
November 17, 2015 at 1:16 pm
First, hierarchies are not inherently balanced. Trying to force them to be balanced is like trying to force a square peg in a round hole. What is the...
November 17, 2015 at 10:57 am
This sounds like the same formatting issue that I proposed a solution for in the thread on store hours.
See if you can adjust that approach to your current situation.
Drew
November 17, 2015 at 10:30 am
mm7861 (11/17/2015)
November 17, 2015 at 8:13 am
First, your GROUP BY and SELECT clauses are intertwined. You cannot simply remove the GROUP BY clause without updating your SELECT clause.
Second, this line contains a GROUP BY clause...
November 16, 2015 at 10:57 am
Viewing 15 posts - 2,866 through 2,880 (of 4,087 total)