Viewing 15 posts - 121 through 135 (of 166 total)
Let's see if I understand correctly.
1 - You want data in the "detail" section for the last five years only, 2008 - 2012.
2 - Any gifts prior to five years...
January 24, 2012 at 1:35 pm
Jonathan,
Nearly but not quite, that just gets next thursday. Not the next first thursday of the month.
I misread the original post. I thought the goal was to find...
January 24, 2012 at 1:19 pm
Having the desired output as a sample would be helpful. I see the 2006 data in the table but I don't see it in the output of the query...
January 23, 2012 at 6:04 pm
The easiest way to compound rows is to CROSS JOIN to another set. The query below returns one row for each record from the system table that stores object...
January 20, 2012 at 11:59 am
I think we use the day of the month as the "anniversary", and crossing an anniversary increments the year or the month. For example, if I was married on...
January 20, 2012 at 11:06 am
One way to archive data in a single step is to use the OUTPUT clause of the DELETE statement. The procedure takes @MaxRows as a parameter, stating the maximum...
January 20, 2012 at 10:31 am
Here is an alternate version using a Tally table.
DECLARE@SelectedDateDATE = '2012-02-01' --GETDATE()
DECLARE@DesiredDayTINYINT = 5
SELECTTOP 1 NextDay, DATENAME(WEEKDAY, NextDay) AS NameOfDay
FROM(
SELECTDATEADD(DAY, N, @SelectedDate) AS NextDay
FROMTally
WHEREN <= 14
) x
WHEREDATEPART(WEEKDAY, NextDay) = @DesiredDay
ORDER...
January 20, 2012 at 10:15 am
You can also open the Excel document directly from SQL Server and SELECT from it just like using a table.
From: http://support.microsoft.com/kb/321686
SELECT * INTO XLImport4 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\test\xltest.xls', [Customers$])
SELECT *...
January 19, 2012 at 6:31 am
Sean Lange (1/18/2012)
January 18, 2012 at 1:10 pm
We are not trying to do an UPDATE or a DELETE, so using the OUTPUT clause with those statements does not help.
We want to get the value of a column...
January 18, 2012 at 9:42 am
I'm going to suggest a different strategy because of the complexity of the need. You need to bring forward each row from the prior month, meaning that if a...
January 18, 2012 at 9:00 am
The OUTPUT clause is going to work only with the MERGE statement.
CREATE-- DROP -- TRUNCATE
TABLECompOrgReference
(
[CompanyID]INTEGERNOT NULL,
[Organization_ID]INTEGERNOT NULL
)
MERGEOrganizationRecords u
USING(
SELECTr.Organization_ID, c.CompanyID, c.CompanyName
FROMCompanyRecords c
LEFT JOIN CompOrgReference r
ONr.CompanyID = c.CompanyID
WHEREr.CompanyID IS NULL
) x
ONx.Organization_ID =...
January 18, 2012 at 8:44 am
Two questions:
1 - Are you saying that DerivedFact is a view, not a table?
2 - Why is CMP1001 copied from two months prior (2011/11) rather than one month prior (2011/12)?...
January 18, 2012 at 7:33 am
CELKO (1/17/2012)
The ANSI syntax is: SET <variable list> = <expression list>;SET (a,b,c) = (1,2,3),
But another way is the row value constructor:
VALUES (1,2,3) AS X ( a,b,c)
Joe seems to...
January 18, 2012 at 7:22 am
Viewing 15 posts - 121 through 135 (of 166 total)