Viewing 15 posts - 31 through 45 (of 109 total)
Dwain,
I bow before the majesty of your CASE / GROUP BY logic. I couldn't figure out how to do it without a temp table.
As my neighbor would say, "that's slicker...
March 7, 2014 at 6:48 am
Moden's string splitter (or any string splitter) can be used in this manner:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION TVF_2col
(
@col varchar(8000)
)
RETURNS TABLE
AS
RETURN
(
select a.item ky,b.item val from
[dbo].[DelimitedSplit8K](@col,'|')...
March 6, 2014 at 2:47 pm
For some reason you don't need the hint if you do it like this.
DECLARE @entityIds XML
SET @entityIds =N'<?xml version="1.0" encoding="utf-16"?>
<ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<int>112350</int>
<int>100886642</int>
</ArrayOfInt>'
---INSERT INTO TEMP TABLE
SELECT Tbl.Col.value('.', 'int') AS val
into #entityIdList
FROM...
March 6, 2014 at 2:31 pm
And one using CASE
select Id, ProductName,cMin from
(
select ID, ProductName, case when cost1<cost2 then cost1 else cost2 end c1,case when cost3<cost3 then cost3 else cost4 end c2
from table_name outer apply (select...
March 6, 2014 at 1:23 pm
Try this TVF. Make sure there are indexes on loaddate in both order and product, with covering columns for ordernuber and product columns.
CREATE FUNCTION tvf_loadDate
(
-- Add the parameters for...
March 6, 2014 at 1:12 pm
Now, the thing I'm struggling with since my concatenated field will never have the same number of values and could look something like this in addition to what I have...
March 6, 2014 at 12:59 pm
jay-h (10/29/2013)
lnardozi 61862 (10/29/2013)
Whip THAT one out in an important...
October 29, 2013 at 4:00 pm
My standard reply when they mispronounce my name the third time is, "It's okay, I know stupid people can't pronounce it."
Whip THAT one out in an important meeting and see...
October 29, 2013 at 5:13 am
No, it's just the script. I figure if you don't already have a CLR library, you probably aren't interested anyway. As far as performance goes it should be pretty linear...
October 26, 2013 at 1:17 pm
I wrote a little CLR stored proc that pivots anything by date. Should be released in the scripts section on Halloween!
Louis
October 25, 2013 at 5:43 pm
Just a thought - category1 thru category5 could just be computed fields. You already have all the information you need in Score.
October 25, 2013 at 5:32 pm
If one query is generating several hundred worker threads that really sounds like you have MAXDOP set to 0 (the default). Since you know the problematic query apparently, just take...
October 18, 2013 at 9:18 am
Parentheses
(SELECT ISNULL(CboValuesTranslations.cboValueTranslationName,ISNULL(CboValues.cboValueName,'')) as Name,
cboValues.cboValueSqlId as SqlId, CboValues.cboValueIncId as IncId,
LTRIM(STR(cboValues.cboValueSqlId))+'-'+LTRIM(STR(CboValues.cboValueIncId)) AS KeyId
FROM ListsOfCboValues INNER JOIN CboValues ON ListsOfCboValues.listOfCboValueSqlId = CboValues.listOfCboValueSqlId AND ListsOfCboValues.listOfCboValueIncId = CboValues.listOfCboValueIncId AND CboValues.isDeleted=0x0 LEFT OUTER JOIN CboValuesTranslations ON...
October 17, 2013 at 9:18 pm
When in doubt, tinker. Tinker with what you are allowed to change (which doesn't sound like much). Can you set MAXDOP to 4? MAXDOP 0 can be a killer as...
October 17, 2013 at 8:59 pm
TRY/CATCH statements are used to rollback a transaction if an error occurs in processing. The COMMIT goes at the end of the TRY and the ROLLBACK goes inside the CATCH....
October 15, 2013 at 7:45 pm
Viewing 15 posts - 31 through 45 (of 109 total)