Viewing 15 posts - 5,491 through 5,505 (of 10,144 total)
deepakagarwalathome (10/2/2012)
Thanks a zillion for your response. That works fine. No problems.
A couple of questions though :-
First, whilst both 'Over Partiion By...' and the derived table sub-query do the...
October 3, 2012 at 9:51 am
ScottPletcher (10/3/2012)
<<snip>>
I consider 20-30% relatively much slower, particularly given how basic the task was.
A 5 min query then takes ~6+ mins instead. Not tragic, obviously, but significant.
The figures are...
October 3, 2012 at 9:04 am
sayedkhalid99 (10/2/2012)
October 3, 2012 at 7:39 am
Koen Verbeeck (10/3/2012)
Brandie Tarvin (10/3/2012)
Koen Verbeeck (9/28/2012)
I know Europe is small, that's why we shipped all the village idiots to another continent to make more room 😀
That would be Australia,...
October 3, 2012 at 4:50 am
ScottPletcher (10/2/2012)
Therefore, I suggest using a lookup table, as suggested by others. You absolutely want...
October 3, 2012 at 3:45 am
John Mitchell-245523 (10/2/2012)
CREATE TABLE CodeActions (
Code char(4)
,TheActionvarchar(12)
)
INSERT INTO CodeActions (Code,TheAction)
VALUES
('ISSP','Install'),
('IECO','Install'),
('IECM','Install'),
('IESP','Install'),
('IEHD','Install'),
('ISHD','Install'),
('FRSI','Install'),
('SB42','Service Call'),
('SB4W','Service Call'),
('HD42','Service Call'),
('HD4W','Service Call'),
('SA2C','Service Call'),
('SA2W','Service Call'),
('HD2C','Service Call'),
('HD2W','Service Call'),
('SNCO','Service Call')
That way you...
October 3, 2012 at 1:51 am
CELKO (10/2/2012)
...NO! We hate UDFs; they are not declarative, do not optimize ...
Nonsense. The OP has explained that (s)he is a novice, Joe, and is willing to learn or wouldn't...
October 3, 2012 at 1:50 am
Smash125 (10/2/2012)
;WITH C AS
(
SELECT *,ROW_NUMBER() OVER(PARTITION BY Status ORDER BY Product) AS Rn FROM #TestData
),
C1 AS
(
SELECT *,MIN(Rn)OVER(PARTITION BY Status) MinRn FROM...
October 2, 2012 at 9:10 am
Smash125 (10/2/2012)
select Product, MIN(status)
FROM MyCTE
GROUP BY Product
the second column says MIN(status) just wanted to know which...
October 2, 2012 at 8:51 am
deepeshdhake (10/1/2012)
I have wrote one store proc. So, in the stored procedure, it is using one table which is in the different database. When I am trying to execute the...
October 2, 2012 at 8:45 am
Eliza (9/30/2012)
Hi all,I have a big long text string that can vary in lengh and contrain audit information about data that has changed in the database...
Thanks
Eliza
Which version of SQL Server...
October 2, 2012 at 8:40 am
Change the order of your test data and see of this solution works:
DROP TABLE #TestData
CREATE TABLE #TestData
(
Product NVARCHAR(100),
Parts NVARCHAR(100),
Status NVARCHAR(100)
)
INSERT INTO #TestData(Product,Parts,Status)
SELECT 'Laptop1','mouse','OK' UNION ALL
SELECT 'Laptop1','screen','OK' UNION ALL
...
October 2, 2012 at 8:20 am
norbert.manyi (10/2/2012)
ChrisM@Work (10/2/2012)
If you can't code it up as a view, then it's unlikely that you can code it up as a query.
You could still do it as a quite...
October 2, 2012 at 8:03 am
norbert.manyi (10/2/2012)
Views would be a better option than functions - coded properly they won't hammer performance quite like the suggested UDF. You can't find a good example right now -...
October 2, 2012 at 7:27 am
waqqas.zia (10/2/2012)
Ok so my case statement should always read @jdt_jty_code?
Yes - the @ tells SQL server that the object is a variable. Your scalar UDF works with changes;
create FUNCTION [dbo].[Tester]...
October 2, 2012 at 7:23 am
Viewing 15 posts - 5,491 through 5,505 (of 10,144 total)