Viewing 15 posts - 4,576 through 4,590 (of 7,610 total)
Create a separate index of just the IDs. Then select a random ID using ORDER BY NEWID(), then use that ID to get the rest of the columns. ...
December 9, 2015 at 1:18 pm
Do you want the concatenation to be able to cause a match? For example, if the PartnerName ends in "f", and the Address begins with "arm", should that cause...
December 9, 2015 at 1:11 pm
If the tables are indexed on id, you just have to force SQL to use the obvious MERGE join it should have been using anyway(!) ๐ :
DROP TABLE #TABLE1
DROP TABLE...
December 8, 2015 at 2:35 pm
Sean Lange (12/8/2015)
ScottPletcher (12/7/2015)
SELECT
COALESCE(t1.PRODUCTID, t2.PRODUCTID, t3.PRODUCTID) AS PRODUCTID,
...
December 8, 2015 at 8:59 am
An INSERT to a table won't try to return a result set ... unless you're missing a:
SET NOCOUNT ON
at the start of the trigger. Verify that statement is present.
Edit:...
December 7, 2015 at 4:59 pm
In this case, there's no real need for CTEs or UNIONs either, just standard FULL joins:
SELECT
COALESCE(t1.PRODUCTID, t2.PRODUCTID, t3.PRODUCTID) AS PRODUCTID,
COALESCE(t3.STATUS,...
December 7, 2015 at 4:50 pm
SQLPain (12/7/2015)
December 7, 2015 at 1:18 pm
Sure, fine, I give up.
Just be aware that using MONTH or any other function on a column could give you horrible performance.
December 7, 2015 at 11:37 am
Month is a datetime type: you need to provide a full date:
@month = '20151001'
December 7, 2015 at 11:25 am
The CROSS JOIN is just used to assign an alias name to the constructed date.
December 7, 2015 at 10:51 am
SQLPain (12/7/2015)
ALTER PROC Applications
(
@Month AS DATETIME,
@Year AS DATETIME
)
AS
BEGIN
LEFT JOIN (SELECT COUNT(CA.app_id) AS Approved_Count, SO.source_id
...
December 7, 2015 at 10:34 am
SQLPain (12/7/2015)
ALTER PROC Applications
(
@Month AS DATETIME,
@Year AS DATETIME
)
AS
BEGIN
LEFT JOIN (SELECT COUNT(CA.app_id) AS Approved_Count, SO.source_id
...
December 7, 2015 at 10:34 am
You'll get best performance only from properly clustering the underlying table. Then either a direct query or a view should perform just fine.
December 7, 2015 at 10:23 am
TheSQLGuru (12/4/2015)
December 7, 2015 at 10:21 am
Code below should filter it for a single month, as specified in @month:
LEFT JOIN (SELECT COUNT(CA.app_id) AS Approved_Count, SO.source_id
...
December 7, 2015 at 10:05 am
Viewing 15 posts - 4,576 through 4,590 (of 7,610 total)