Viewing 15 posts - 3,451 through 3,465 (of 8,731 total)
Hugo Kornelis (1/29/2016)
Luis Cazares (1/29/2016)
SELECT Id,
Amount,
CashFlowDate
FROM #Test
CROSS APPLY( VALUES(Principal, 'Principal'), (Interest,...
January 29, 2016 at 12:27 pm
Wild idea:
If you can't create adequate indexes on this table, try creating a new table with the same structure but proper indexes (probably clustering on TestDTTM) and load the data....
January 29, 2016 at 11:53 am
Iulian -207023 (1/29/2016)
Jacob Wilkins (1/29/2016)
Iulian -207023 (1/29/2016)
OK , but why is the Id incremented and Id = 3 skipped ?Ta,
Iulian
From https://msdn.microsoft.com/en-us/library/ms186775.aspx, under "Remarks":
For a given identity property with...
January 29, 2016 at 10:22 am
Maybe this:
DECLARE @date varchar(10) = '14-Apr'
SELECT CONVERT(datetime, '01 ' + RIGHT(@date,3) + ' ' + LEFT(@date,2), 6)
January 29, 2016 at 10:20 am
Koen Verbeeck (1/29/2016)
Grant Fritchey (1/29/2016)
BL0B_EATER (1/29/2016)
Have you guys during your careers ever thought about doing something else in life.. as opposed to IT / SQL Server / Coding etc etc?
Yeah,...
January 29, 2016 at 10:16 am
You don't have any default value. I'm guessing that you're trying to insert rows with new ids which would return a null value which is not equal to 1 and...
January 29, 2016 at 10:13 am
Exactly as twin.devil posted, maybe with less characters.
DECLARE @start_date DATETIME;
DECLARE @end_date DATETIME;
SET@start_date = '2005-01-01';
SET@end_date = DATEADD(yy, DATEDIFF(yy,0,getdate()) + 1, -1);
WITH
E(n) AS(
SELECT 0 UNION ALL SELECT...
January 29, 2016 at 9:11 am
Yet another option. However, I'm not sure which of the proposed versions would be the best option.
SELECT Id,
Amount,
CashFlowDate
FROM #Test
CROSS APPLY( VALUES(Principal, 'Principal'), (Interest, 'Interest')) x(Amount,AmtType)
WHERE Amount >...
January 29, 2016 at 9:08 am
There are some objects that can be created inside a TRY/CATCH block, such as tables and indexes. Some objects, such as procedures should be the only thing in the batch....
January 29, 2016 at 8:26 am
tom.w.brannon (1/29/2016)
January 29, 2016 at 8:05 am
Orlando Colamatteo (1/28/2016)
January 28, 2016 at 7:39 pm
nhernandez 63958 (1/28/2016)
Im trying to sort out the SELECT n FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0))E(n) could you explain the nature of this method, please.Regards.
Sure. This is called a Table Value Constructor. It's a...
January 28, 2016 at 6:21 pm
Two things to note:
1. You're not using the correct value to order and your weeks might come in a wrong order.
2. You shouldn't use recursive CTEs to generate rows. An...
January 28, 2016 at 2:09 pm
powerofsound (1/28/2016)
I love when I find out my code is doing something stupid, I learn something new every day I'm in SQL and you have opened my eyes...
January 28, 2016 at 12:01 pm
There's an issue when using NOT IN and the inner query returns a NULL value. In that case, it won't return any rows. You can correct that adding an additional...
January 28, 2016 at 11:38 am
Viewing 15 posts - 3,451 through 3,465 (of 8,731 total)