Viewing 15 posts - 5,146 through 5,160 (of 8,731 total)
Do you mean at the date of the appointment?
SELECT *
FROM TEST
WHERE DOB BETWEEN DATEADD(YYYY, -5, ApptDt2) AND DATEADD(MM, -6, ApptDt2)
March 3, 2015 at 9:18 am
ron.grace 36037 (3/3/2015)
@Dest1 + (DT_STR, 4 , 1252)DATEPART( "year" , GETDATE() ) + "" + RIGHT( "00"...
March 3, 2015 at 8:41 am
It's been a while since I'd use or suggest a scalar function as a solution to a problem.
Instead, this should do it.
SELECT dob,
CASE WHEN DATEADD(YYYY, DATEDIFF(YYYY,...
March 3, 2015 at 8:25 am
Do you have errors in your calculations (getting incorrect age) or errors thrown by SQL Server that might come from incorrect data?
March 2, 2015 at 4:06 pm
SQL_NuB (3/2/2015)
ScottPletcher (3/2/2015)
SELECT ...
FROM table1 t1
INNER JOIN...
March 2, 2015 at 2:15 pm
Your first problem which generates an error is that you're missing quotes in your last 2 steps. This will throw an error when your path has spaces in it.
ALTER procedure...
March 2, 2015 at 1:21 pm
I wonder if the answer is incorrect because the maximum number of databases in an instance is 32,767.
But you can create as many databases as you wish as long as...
March 2, 2015 at 12:55 pm
Of course, if you're returning just 4 rows it won't make a difference. 🙂
As with most things in SQL, it depends.
March 2, 2015 at 10:30 am
The problem is that we don't know what's inside of p_CreateExcel. The code creates what I suppose is a valid path with a file that includes the date. I'm not...
March 2, 2015 at 10:26 am
This is going to be slow.
You might gain speed with an additional order column. It could be a persisted computed column.
March 2, 2015 at 9:49 am
I would simplify it.
SELECT Customer, [Type], DueDate1, DueDate2
FROM dbo.myTable mt
WHERE mt.[Type] = @Type
AND (mt.DueDate1 BETWEEN @DueDate1 AND @DueDate2 OR @Condition1 = 0)
AND (mt.DueDate2 BETWEEN @DueDate1 AND @DueDate2 OR @Condition2...
March 2, 2015 at 8:42 am
This is how I would do it.
For references:
Creating the dynamic code[/url]
DECLARE @sql nvarchar(4000);
SELECT @sql = 'SELECT t1.ID, t1.Name, ca.YrMnth, ca.Enrollment
FROM #Table1...
March 2, 2015 at 8:08 am
Katerine459 (2/27/2015)
... what is that?
This generates a Tally table on the fly with zero reads.
Could you please take me through what that does? Your comment, "Enough for 12 years"...
February 27, 2015 at 3:54 pm
This is an option. It's not perfect but should be better that your current process. Someone else could improve the code. It would be nice to know what are you...
February 27, 2015 at 1:56 pm
You have 2 main issues in here which cause performance problems.
1. Multi-statement table-valued function
2. (Nested) while loops
Those two can (and will) kill performance severely.
February 27, 2015 at 11:57 am
Viewing 15 posts - 5,146 through 5,160 (of 8,731 total)