Viewing 15 posts - 31 through 45 (of 394 total)
I've come up with something similar, but using Jonathan's suggestion about the where clause.
USE [tempdb]
GO
DECLARE @DateFrom Date = '01 Aug 2018', @DateTo Date...
August 8, 2018 at 8:39 am
-- SQL 2012: Using Jeff Moden's string splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/
WITH CTE AS
(
SELECT F_PRODUCT, a.F_CAS_NUMBER, b.F_COMPONENT_ID
FROM dbo.PDF_MSDS
CROSS APPLY (SELECT Item FROM [dbo].[DelimitedSplit8K](F_CAS_NUMBERS,...
August 8, 2018 at 7:24 am
Not really sure what you're aiming for here.
Can you explain in a bit more detail.
August 8, 2018 at 5:40 am
How about
DECLARE @Increment Int = 0 -- or -1
SELECT
CT.claim_type_name AS ClaimType,
COUNT(CM.claim_type) AS Cases,
ISNULL(SUM(CC.original_amount),0) AS SumInsuredTotal
INTO #ChosenYear
August 8, 2018 at 5:24 am
You really are working too hard to accomplish what you want.
Does this do...
August 8, 2018 at 2:15 am
What are you actually trying to do? Are you moving views from one database to another?
August 7, 2018 at 9:25 am
Are you still trying to do this?
What is the purpose? Do you want to move views from one database to another?
August 7, 2018 at 8:45 am
If you're using SQL 2012 you will need a string splitter. I've used Jeff Moden's - see http://www.sqlservercentral.com/articles/Tally+Table/72993/
For SQL 2016 onwards you can use STRING_SPLIT.
[code...
August 7, 2018 at 4:49 am
I can't recreate the error. I created a database DATABASE_BI, ran the code & it was all fine.
July 30, 2018 at 9:58 am
The danger there is losing the use of indexes, especially in joins, & getting a big performance hit...
July 30, 2018 at 7:12 am
That's true - it is a bit scrappy.
Tidied up:
USE [tempdb];
GO
-- Test data:
IF OBJECT_ID('dbo.Data1') IS NOT NULL DROP TABLE dbo.Data1;
July 30, 2018 at 7:07 am
You can use a recursive query to get the levels for heirarchical data:
USE [tempdb]
GO
-- Test data:
DROP TABLE dbo.Data1;
July 30, 2018 at 3:35 am
You do not need a cursor for this. You can just do the following
select @last_key_in_range = ISNULL(MAX(control_num) , -1)
from Tbl_Determination
where control_num>=CAST(@control_number_start as...
July 27, 2018 at 8:41 am
You could do this.... not sure if it's what you mean by "Total by Years".
USE [tempdb]
GO
-- Test data:
drop table...
July 27, 2018 at 4:14 am
That should work in SQL 2008. What's the problem?
July 26, 2018 at 5:37 am
Viewing 15 posts - 31 through 45 (of 394 total)