Viewing 15 posts - 3,676 through 3,690 (of 8,731 total)
Now I see what's going on. Since you didn't post your sample data in a consumable way even if you've been around a long time, I'll just point you to...
December 4, 2015 at 2:10 pm
Maybe something like this:
SELECT id
,knt
,dt
,name
...
December 4, 2015 at 1:56 pm
I prefer to do it using CROSS APPLY and table constructors. Here's an article on that: http://www.sqlservercentral.com/articles/CROSS+APPLY+VALUES+UNPIVOT/91234/
IF OBJECT_ID('tempdb..#test') IS NOT NULL
DROP TABLE #test
CREATE TABLE #test (colx...
December 4, 2015 at 1:37 pm
What have you tried? Where's the sample data and expected results?
December 4, 2015 at 1:26 pm
PhilPacha (12/4/2015)
Thanks for the update about datetime --> date; I wasn't aware of that.
I just wanted to include a test because people shouldn't just trust anything they read online. 😉
--=====...
December 4, 2015 at 12:57 pm
PhilPacha (12/4/2015)
December 4, 2015 at 12:29 pm
First of all, you need to reference the CTE through a SELECT statement. Something like this:
--Insert a reservation for a key during specific dates
WITH Dates AS (
SELECT
[Date] = CONVERT(date,'20151127')
UNION ALL...
December 4, 2015 at 12:01 pm
Jeff Moden (12/4/2015)
December 4, 2015 at 8:39 am
FridayNightGiant (12/4/2015)
You could use a CTE or subquery to initially select the rows with valid dates...
Actually, that's also prone to error. Even with a view, the error could appear.
I like...
December 4, 2015 at 7:52 am
I don't remember most of Doof's inventions, but my favorites are the Inator-inator and Norm. 😀
December 4, 2015 at 7:27 am
Sean Lange (12/3/2015)
Alan.B (12/3/2015)
I am curious about a couple things here.
Why MAX(c)?
(MAX(c),'No Colour')
To always return a row, either with a value or a null. I might have done it different,...
December 3, 2015 at 1:53 pm
Here's your sample data in a proper format so anyone can test a solution. Please post it this way next time.
CREATE TABLE TableA(
personid int,
...
December 3, 2015 at 12:08 pm
A filtered index might do the trick, but only for the condition defined to filter the index. With that, you simply query sys.dm_db_partition_stats, something like this:
SELECT SUM (row_count)
FROM sys.dm_db_partition_stats s
JOIN...
December 3, 2015 at 11:55 am
Can you give some examples of your inputs and ouputs?
You added a lot of work when it's not needed. Your function can be reduced to a single statement.
Do you have...
December 3, 2015 at 10:53 am
It's not exactly about the users, but about how the data changes.
Ideally, you'll do it daily. However, you might not need to have index/statistics maintenance tasks daily and you can...
December 3, 2015 at 10:05 am
Viewing 15 posts - 3,676 through 3,690 (of 8,731 total)