Viewing 15 posts - 2,626 through 2,640 (of 4,087 total)
SELECT *, CAST(COUNT(sales) OVER(PARTITION BY e.customerId) AS BIT)
FROM #example e
Drew
May 26, 2016 at 1:39 pm
dogramone (5/26/2016)
Try running with the variable dates in dd-mon=ccyy format to help with debugging, ie '01 jan 1900
Do not EVER do this. I believe that there are only two...
May 26, 2016 at 12:38 pm
You're setting your @startdate twice, so the @enddate is NULL.
Drew
May 26, 2016 at 12:31 pm
Setting Up Your SQL Server Agent Correctly.[/url] Especially pay attention to the section What service account to use.
Drew
May 26, 2016 at 12:17 pm
Jacob Wilkins (5/26/2016)
drew.allen (5/26/2016)
May 26, 2016 at 12:07 pm
Well, the documentation for nchar and nvarchar still says that the the value can be any number from 1 to 4000 or max, and 5000 is clearly not in that...
May 26, 2016 at 9:51 am
Not the creator name, the account the job is running under. If I remember correctly, by default, this is a SQL account which HAS NO ACCESS TO NETWORK DRIVES....
May 26, 2016 at 9:44 am
Lowell (5/26/2016)
SELECT row_number() over(partition By T2.code_name ORDER BY T2.code) AS RW,T2.code_name As DesiredCodeName,T1.*
FROM dbo.table1 T1
...
May 26, 2016 at 7:43 am
John Mitchell-245523 (5/26/2016)
DesNorton (5/25/2016)
Create a standard column [NICKNAME]
Create an INSERT trigger that sets [NICKNAME] = [LASTNAME] + ' ' + [FIRSTNAME]
Then the column...
May 26, 2016 at 7:35 am
Sturev (5/25/2016)
drew.allen (5/25/2016)
Here is another approach. This has the advantage that it accounts for orphaned records.Drew
Thanks Drew! In this case we don't want the orphans; I know, not ideal...
May 25, 2016 at 12:54 pm
Also, the reason that you are getting NULLs is that the following code is looking for cases where the CompanyName field is equal to the literal strings 'CompanyPrevName1' and 'CompanyPrevName2'....
May 25, 2016 at 12:47 pm
Try the following:
; WITH chi_nm AS (
SELECT *, ROW_NUMBER() OVER(PARTITION BY chi.CompanyID, LEFT(chi.PreviousCompanyName, 3) ORDER BY chi.NameYear DESC) AS rn
FROM (
VALUES
(1,'Kay Enterprises',2015),
(1,'The Kay INC',2014),
(1,'Kay INC',2013),
(1,'Kay Group',2012),
(2,'RIDGE',2015),
(2,'The RIDGE PARTNERS',2014),
(2,'Medical Company of...
May 25, 2016 at 12:34 pm
Here is another approach. This has the advantage that it accounts for orphaned records.
SELECT
ROW_NUMBER() OVER(ORDER BY a1.AFFILIATIONID) NewRecordID,
a1.ENTITYID AS FromRecordID,
a2.ENTITYID ToRecordID
FROM #a a1
LEFT OUTER JOIN #a a2
ON a1.AFFILIATIONID =...
May 25, 2016 at 11:47 am
I believe the following will work in SQL2008. I don't have a SQL2008 test environment handy to test.
;
WITH pd AS (
SELECT
pd.PatientNumber,
pd.DCDispCode,
pd.DCDate,
MAX(CASE WHEN pd.DCDispCode = '20' THEN pd.DCDate END) OVER(PARTITION...
May 24, 2016 at 3:37 pm
Brandie Tarvin (5/24/2016)
What an interesting day it's been already. @=)
Apparently FETCH...
May 24, 2016 at 8:20 am
Viewing 15 posts - 2,626 through 2,640 (of 4,087 total)