Viewing 15 posts - 796 through 810 (of 1,246 total)
Something like this...
DECLARE
@BegDate DATE = '2016-01-05',
@EndDate DATE = '2016-06-22';
WITH
n (n) AS (SELECT 1 FROM (VALUES (1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) n (n)),
cte_MonthStart (MonthBeg) AS (
SELECT TOP (DATEDIFF(mm, @BegDate, @EndDate) +1)
CAST(DATEADD(mm, ROW_NUMBER()...
October 5, 2016 at 9:56 am
October 5, 2016 at 9:07 am
This is a situation where a function will actually out perform a permanent tally table...
The function...
CREATE FUNCTION dbo.tfn_Tally
(
@RowCount INT
)
RETURNS TABLE WITH SCHEMABINDING
RETURN
WITH
n (n) AS (SELECT 1 FROM (VALUES (1),(1),(1),(1),(1),(1),(1),(1),(1),(1))...
October 5, 2016 at 8:49 am
You have 2 columns that have the ANSI Padding turned off in the middle of the table.
October 5, 2016 at 7:45 am
rocky_498 (9/28/2016)
So, what should I do?Technical I want to exclude those records when BOTH COLUMNS are NULL
Any advise?
Just think about what you're asking SQL Server to return to you... If...
September 29, 2016 at 7:06 am
rocky_498 (9/28/2016)
WHERE CID IS NOT NULL
AND MID IS NOT NULL
This means when both conditions met
if my query is...
September 28, 2016 at 9:28 pm
rocky_498 (9/28/2016)
...
SELECT * FROM Null_Table
WHERE CID IS NOT NULL
AND MID IS NOT NULL
Note:- Please help me to understand, I should receive 3 records after I run the final query, why...
September 28, 2016 at 7:59 pm
valeryk2000 (9/27/2016)
September 27, 2016 at 8:07 pm
Here are two solutions... The 1st will work in 2008 & 2008R2. The 2nd will work with 2012 and above...
Note: The full script, including the creation & population of test...
September 27, 2016 at 6:31 pm
Srl832 (9/27/2016)
September 27, 2016 at 1:11 pm
Your problem is that you have nothing to bind the row groups together. Take a look at what I did below by adding a "SetNum" column to the data...
Once...
September 27, 2016 at 12:45 pm
Almost sounds like you should actually post representative sample data and the expected results based on that data...
Forum Etiquette: How to post data/code on a forum to get the best...
September 27, 2016 at 10:49 am
To reiterate what Phil & Grant said... Answering questions here on this forum...
I can't speak for anyone else but I've learned an incredible amount here on this forum... Answering other...
September 27, 2016 at 7:19 am
Why not simply TRUNCATE the table?
September 26, 2016 at 9:42 pm
If you want all of the data...
WITH
cte_temp AS (
SELECT
rn = ROW_NUMBER() OVER (PARTITION BY t.[Date], t.[Type] ORDER BY t.[Value]),
t.Date,
t.Type,
t.Value
FROM
#temp t
)
SELECT
[Schema] = MIN(CASE WHEN t.Type = 'Schema' THEN t.Value...
September 26, 2016 at 8:10 pm
Viewing 15 posts - 796 through 810 (of 1,246 total)