Viewing 15 posts - 4,021 through 4,035 (of 8,731 total)
I'm guessing that it could be an expensive sort if the index columns are not in the same order. Possible blocking on any of the 3 tables.
Could you post the...
October 16, 2015 at 10:38 am
Suth (10/16/2015)
My last...
October 16, 2015 at 10:21 am
You mean like this?
Select Region,
Amount / 12 AS Jan2015,
Amount / 12 AS Feb2015,
--...
Amount /...
October 16, 2015 at 10:14 am
My wild guess would be something like this:
CREATE FUNCTION [dbo].[eufn_e5_eSM_SE_GetCurrentContentForContainer]
(
@containerSqlId SMALLINT,
@containerIncId INT
)
RETURNS TABLE
AS
RETURN
SELECTCC.contentSqlId,
CC.contentIncId,
CC.contentMetaTableSqlId,
CC.contentMetaTableIncId
FROM [dbo].[ContainersContents] CC
WHERECC.containerSqlId = @containerSqlId AND
CC.containerIncId = @containerIncId AND
CC.isDeleted = 0
UNION ALL
SELECT ccc.*
FROM [dbo].[ContainersContents] CC
CROSS APPLY [dbo].[eufn_e5_eSM_SE_GetCurrentContentForContainer](CC.contentSqlId, ...
October 16, 2015 at 9:09 am
As Sean said, this is an awful design. These should be columns instead of rows. All of these columns are totals and should be treated like that. The formulas can...
October 16, 2015 at 8:57 am
I feel like I was obligated to get it right since I wrote the second article in the references. 😀
October 16, 2015 at 8:39 am
Quick option: Use cross tabs.
select
SUM( CASE WHEN category = 'cat1' THEN salesprice ELSE 0 END) AS cat1_salesprice,
SUM( CASE WHEN category =...
October 15, 2015 at 2:14 pm
sa02000 (10/15/2015)
Thank you for quick responses. Does it make a difference if I download 32 vs 64 bit?Jay
Yes, 32-bit has several limitations listed in here: https://msdn.microsoft.com/en-us/library/ms143432(v=sql.120).aspx
However, a 64 bit version...
October 15, 2015 at 2:07 pm
You could use the DelimitedSplit8k found in here: http://www.sqlservercentral.com/articles/Tally+Table/72993/
SELECT
J.DT_ID
,J.InvNo
,sc.Item AS SalesCode
,a.Item AS Amount
FROM @TEST_DATA J
CROSS APPLY...
October 15, 2015 at 2:02 pm
I wouldn't use nulls to represent a zero value. But I could see a valid option if there's an unknown value that might be defined later. You could also...
October 15, 2015 at 1:18 pm
I wouldn't allow nulls on data type money for the simple reason that I wouldn't allow the money data type.
Regarding the real question, I guess it depends more on the...
October 15, 2015 at 12:48 pm
Phil Parkin (10/15/2015)
Luis Cazares (10/15/2015)
You can use either the SQL Server Express Edition which is free. It has several limitations, but for simple use, it should be fine.
Where is the...
October 15, 2015 at 10:24 am
For the row counts, you can use the following:
SELECT OBJECT_NAME( object_id) AS TableName,
SUM( row_count) AS Row_Count
FROM sys.dm_db_partition_stats
WHERE index_id IN(1,0)
GROUP BY object_id
For statistics and index maintenance, you...
October 15, 2015 at 10:06 am
You can use either the SQL Server Express Edition which is free. It has several limitations, but for simple use, it should be fine.
October 15, 2015 at 9:53 am
rs80 (10/14/2015)
But doesn't CROSS APPLY have a different purpose than CROSS JOIN?
Yes, it allows you to reference columns from the previous tables to use in correlated subqueries or functions.
In this...
October 14, 2015 at 9:50 am
Viewing 15 posts - 4,021 through 4,035 (of 8,731 total)