Viewing 15 posts - 4,831 through 4,845 (of 10,144 total)
abhas (4/12/2013)
Please help me on below scenario.
I am having application where user selects startdate and enddate from his application(front end). but if he selects Startdate is 2013/01/01 and EndDate...
April 12, 2013 at 7:52 am
Either of these:
SELECT Name, MAX(version) OVER(PARTITION BY Name)
FROM table1
WHERE name = 'Asdf';
SELECT Name, MAX(version)
FROM table1
WHERE name = 'Asdf'
GROUP BY Name;
Avoid doublequotes, they have a special...
April 12, 2013 at 7:49 am
;WITH Resolver AS (
SELECT [Level] = 1, CompanyID, CompanyName, Heirarchy, ParentCompanyID,
Hpath = CAST(CompanyID AS VARCHAR(50))
FROM Company
WHERE ParentCompanyID = 0
UNION ALL
SELECT [Level] = r.[Level]+1, c.CompanyID, c.CompanyName, c.Heirarchy, c.ParentCompanyID,
Hpath = CAST(r.Hpath...
April 12, 2013 at 7:38 am
Here's an alternative with no CTE or ranking function:
SELECT
s.*,
y.ReasonToKeep
FROM Sampledata s -- CI scan
OUTER APPLY (...
April 12, 2013 at 6:35 am
Last years' sales belong in a different table, say SalesHistory - with a column for time period, in your current case - year. This makes both tables narrower and allows...
April 12, 2013 at 5:59 am
ByronOne (4/11/2013)
Is it possible to adapt this code slightly so that rather than updating the sales figures for a specified product type ie LEISURE. It creates a new product...
April 12, 2013 at 5:53 am
sudhirnune (4/12/2013)
set @string = '-1 * [ALL_1] + [BAL] - [SAL]'
declare @pos int
declare @piece varchar(500)
declare @EXIS_VALUE VARCHAR(100)
declare @string_new varchar(500)
--Need to tack a delimiter onto the end of the...
April 12, 2013 at 3:20 am
This is an interesting one Arjun! Can you post the actual plan please?
April 12, 2013 at 1:27 am
sudhirnune (4/11/2013)
I have a String as in put, I need to Extract the Data in teh String.
Delimiter for the String is "["
String: -1 * [SAL] + [COMM] -...
April 12, 2013 at 1:22 am
Lynn Pettis (4/11/2013)
April 11, 2013 at 9:50 am
curious_sqldba (4/11/2013)
ChrisM@Work (4/11/2013)
Lynn Pettis (4/10/2013)
April 11, 2013 at 9:18 am
Lynn Pettis (4/10/2013)
April 11, 2013 at 8:52 am
I only see one plan for the conditional select, the same plan whichever parameter I use. It's what I'd expect to see. Am I missing something?
April 11, 2013 at 7:45 am
You're welcome. Thanks loads for posting a sample data script - it doesn't half make a difference 🙂
April 11, 2013 at 7:22 am
-- Query 1 have a gander at the data
SELECT
o.*,
p.Name,
x.CurrWeek
FROM tblOrder o
LEFT JOIN tblProduct p ON p.ProductID = o.ProductID
CROSS APPLY (SELECT CurrWeek = DATEPART(week,o.OrderDate)) x
WHERE o.OrderDate >=...
April 11, 2013 at 6:23 am
Viewing 15 posts - 4,831 through 4,845 (of 10,144 total)