Viewing 15 posts - 6,031 through 6,045 (of 10,144 total)
This is similar to Cadavre's but aggregates within the APPLY:
Select
t1.id1, [description] = x.description1,
t1.id2, [description] = x.description2,
t1.id3, [description] = x.description3,
t1.id4, [description] = x.description4
From Table1 t1
CROSS APPLY (
SELECT
Description1 = MAX(d.Description1),
Description2...
July 25, 2012 at 7:07 am
Gazareth (7/25/2012)
Phil Parkin (7/25/2012)
ChrisM@Work (7/25/2012)
Don't forget that TOP is meaningless without...
July 25, 2012 at 6:51 am
Phil Parkin (7/25/2012)
ChrisM@Work (7/25/2012)
Don't forget that TOP is meaningless without ORDER...
July 25, 2012 at 6:17 am
Jeff Moden (7/22/2012)
ChrisM@home (7/22/2012)
SELECT
t1.col1,
col2 = ISNULL(t1.col2, x.col2)
FROM @T t1
OUTER APPLY (
SELECT TOP 1
t2.col2
FROM @T t2
WHERE t2.col1 > t1.col1
AND t2.col2...
July 25, 2012 at 4:12 am
beeramgopi (7/25/2012)
(RowId INT, CustomerId INT, TransId INT, Pts INT)
INSERT INTO @CumCredit (Rowid, CustomerID, TransId, pts)
select 1,123,121,10
union
select 2,123,131,20
union
select 3,123,141,15
select * from @CumCredit
select a.*, (select sum(Pts) from @CumCredit where...
July 25, 2012 at 4:02 am
krishna.netblogs (7/24/2012)
I have a table Tbl1 with the below properties
having 200 lakhs records.
30 Columns
6 columns are configured with Non-Unique,Non-Clustered Index
1 Column with Clustered Index
I have to execute the below...
July 25, 2012 at 2:22 am
Ajdba (7/24/2012)
Sorry, I meant to say I need to know how can prevent from sql injection
Best way is not to use dynamic SQL. Are you sure you need to?
SELECT
IncidentIdNbr,...
July 24, 2012 at 8:23 am
cascaded (CROSS) APPLY is ideal for this:
DROP TABLE #Sample
CREATE TABLE #Sample (username VARCHAR(20), gender CHAR(1), agegroup VARCHAR(3), profiles VARCHAR(20), profile_new VARCHAR(20))
INSERT INTO #Sample
SELECT username = 'Edward', gender = 'm', agegroup...
July 24, 2012 at 7:13 am
XMLSQLNinja (7/23/2012)
ChrisM@home (7/20/2012)
XMLSQLNinja (7/18/2012)
...There are other ways to do this but using recursion is generally the fastest.
Recursion is the third fastest; CLR > "Quirky Update" > rCTE > cursor >...
July 24, 2012 at 5:18 am
SQLRNNR (7/23/2012)
C6H12O6
6-(hydroxymethyl)oxane-2,3,4,5-tetrol
July 23, 2012 at 9:51 am
You guys have been having way too much fun while I've been away.
The plan for this query (once the missing ORDER BY is in place)
lokeshvij (7/22/2012)
July 23, 2012 at 2:35 am
CELKO (7/12/2012)
... WHERE S.sales_order_id = D.sales_order_id;
Better duck now, Joe.
July 12, 2012 at 9:48 am
Not all experienced SQL Server developers appreciate the importance of code performance - as a relative newcomer it may have passed you by, even after lurking around here for a...
July 12, 2012 at 9:44 am
ash.rvp1 (7/12/2012)
Thank you for your feedback.
How does DR_Premier_PO_O fit into all this? There are various references to it in your script but none of them make much sense. If it's...
July 12, 2012 at 8:49 am
SGT_squeequal (7/12/2012)
i used the loop before any of the set based ooptions appeard plenty to ponder for the future :);-)
If you chose a looping method over 5 faster, simpler set-based...
July 12, 2012 at 8:32 am
Viewing 15 posts - 6,031 through 6,045 (of 10,144 total)