Viewing 15 posts - 4,036 through 4,050 (of 7,614 total)
This should be more efficient:
SELECT VisitID
FROM #Test
GROUP BY VisitID
HAVING MAX(CASE WHEN IsPrimaryCareProvider ='Y' THEN 1 ELSE 0 END) = 0
November 23, 2016 at 8:34 am
First, the Project table should be keyed on ( DomainID, SchoolID, ID ), if, as your example query implies, Domain is the more dominant "parent" relation. Reverse the first two...
November 22, 2016 at 11:19 am
Something like this should do it:
IF OBJECT_ID('tempdb.dbo.#table2_data') IS NOT NULL
DROP TABLE #table2_data
--create the table structure for #table2_data
SELECT TOP (0)
Application,
...
November 16, 2016 at 11:19 am
You have a couple of choices.
If you are willing to allow them to run any (local) job, you can add them to the SQLAgentOperatorRole in msdb.
If you want them to...
November 14, 2016 at 11:54 am
Is this acceptable? No.
Can this be improved? Yes.
Most importantly, you do not need an identity column on two of these tables. Despite what some people may imply, there's no...
November 10, 2016 at 10:39 am
The real solution is very likely to cluster the table on event_date, if that is how you most often query the table. You'll get minimum I/O without having to...
November 8, 2016 at 1:43 pm
TheSQLGuru (11/8/2016)
ScottPletcher (11/8/2016)
It depends on how complex the trigger logic and how much different it is for each type of modification whether you want separate triggers or not.
I disagree on...
November 8, 2016 at 1:29 pm
It depends on how complex the trigger logic and how much different it is for each type of modification whether you want separate triggers or not.
But you can definitely simplify...
November 8, 2016 at 8:24 am
drew.allen (11/3/2016)
ScottPletcher (11/3/2016)
November 3, 2016 at 3:55 pm
drew.allen (11/3/2016)
ScottPletcher (11/3/2016)
UPDATE table_name
SET Foo = CASE WHEN Foo > '' THEN ', ' ELSE '' END +...
November 3, 2016 at 3:53 pm
J Livingston SQL (11/3/2016)
ScottPletcher (11/3/2016)
SELECT
SD.NUMBERS
,RIGHT('0000000' + REPLACE(NUMBERS, '.', ''), 7)
FROM SAMPLE_DATA SD;
which I believe is what...
November 3, 2016 at 12:18 pm
You could try limiting the pattern matching to only the text between "[whitespace-char]WHERE[whitespace-char]" and the next occurrence of "GROUP BY" or "SELECT". Of course that's also not perfect, but...
November 3, 2016 at 11:47 am
SELECT
SD.NUMBERS
,RIGHT('0000000' + REPLACE(NUMBERS, '.', ''), 7)
FROM SAMPLE_DATA SD;
November 3, 2016 at 11:42 am
I avoid the ISNULL "tricks" when I can in favor of straightforward code:
UPDATE table_name
SET Foo = CASE WHEN Foo > '' THEN ', ' ELSE '' END + 'newvalue'
November 3, 2016 at 11:39 am
Sorry, don't have a lot of time, but here's my best guess at what could help:
SELECT i.Item_ID AS Kit_SID
, i.Item_ID AS Kit_ID
, i.Item_NO AS Kit_NO
...
November 1, 2016 at 3:18 pm
Viewing 15 posts - 4,036 through 4,050 (of 7,614 total)