Viewing 15 posts - 2,221 through 2,235 (of 4,085 total)
You really should be using sp_execute_sql rather than EXEC (). sp_execute_sql will allow you to pass in parameters, which helps to protect against SQL injection.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 25, 2016 at 12:02 pm
larrycook74 (10/24/2016)
it gave me all three "dRank"...
There is no dRank in my query. I specifically removed it because it was unnecessary.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 24, 2016 at 1:08 pm
It does work, your partition is wrong.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 24, 2016 at 1:00 pm
larrycook74 (10/24/2016)
That didn't work... 🙁
Here is some sample data, when you have time to check it out.
Create Table tempSero
(
CaseId varchar(20)
, rDate...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 24, 2016 at 11:46 am
This is known as the packing intervals problem. Itzik Ben-Gan wrote up a New Solution to the Packing Intervals Problem. You're going to need to pack the intervals...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 24, 2016 at 11:33 am
Since we don't have sample data to work with, it's difficult to come up with a query. Try this approach.
WITH CTE AS (
SELECT
r.CaseFileIdentifier
, DateAdd(hour,-7,r.ReferredOn) as ReferralDate
, sv.Name
, sv.Value
,...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 24, 2016 at 10:14 am
I would just use integer division and remainders. x / ticks_per_day gives the number of full days that have passed and x % ticks_per_day gives the remaining ticks. ...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 24, 2016 at 9:54 am
If I understand correctly, just change your ORs to ANDs in your original query. You're getting rows where ANY column does not contain any of those values, but you...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 24, 2016 at 9:26 am
Since you've posted to a SQL 2012 forum, you might want to use a feature that was introduced in SQL 2012 specifically for paging: OFFSET/FETCH.
DECLARE @pg INT = 1,
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 24, 2016 at 9:01 am
Something like the following?
WITH absences AS (
SELECT *, COUNT(absence_dt) OVER( PARTITION BY student_id ORDER BY attendence_dt ROWS UNBOUNDED PRECEDING) AS absence_cnt
FROM attendence
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2016 at 5:55 pm
jeff.born (10/21/2016)
Drew,I'm not sure how to write the ISNULL version.. This syntactically incorrect version I came up with is:
The ISNULL replaces the result of the STUFF with the original address.
You...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2016 at 5:34 pm
When switching from row-based processing to set-based processing, you have to understand that the set will either succeed or fail as a whole. You can either pre-screen your data...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2016 at 2:41 pm
jeff.born (10/21/2016)
INSERT INTO [dbo].[Address] ([Address]) VALUES ('48 Martin Luther King');
There is...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2016 at 2:30 pm
If value isn't correct and SUM(value) isn't correct, it's not clear what IS correct without sample data and expected results. Please read the first link in my signature to...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2016 at 1:15 pm
Unfortunately, I'm not sure that it will work in this case, because the article does calculations on constants, but reworking it for this, would require doing those same calculations on...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 21, 2016 at 12:10 pm
Viewing 15 posts - 2,221 through 2,235 (of 4,085 total)