Viewing 15 posts - 2,221 through 2,235 (of 4,087 total)
Jeff Moden (10/25/2016)
As a bit of a sidebar, it would have been nice if they had it default to a ROWS specification because it's faster than the RANGE specification.
The reason...
October 26, 2016 at 8:52 am
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
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
October 24, 2016 at 1:08 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...
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...
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
,...
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. ...
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...
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,
...
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
...
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...
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...
October 21, 2016 at 2:41 pm
jeff.born (10/21/2016)
INSERT INTO [dbo].[Address] ([Address]) VALUES ('48 Martin Luther King');
There is...
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...
October 21, 2016 at 1:15 pm
Viewing 15 posts - 2,221 through 2,235 (of 4,087 total)