Viewing 15 posts - 556 through 570 (of 3,544 total)
SELECT CAST(
CASE SIGN(DATEPART(dy,@Enddate)-DATEPART(dy,@Startdate))
WHEN 0 THEN DATEDIFF(year,@Startdate,@Enddate)
WHEN 1 THEN DATEDIFF(year,@Startdate,@Enddate)+(DATEPART(dy,@Enddate)-DATEPART(dy,@Startdate))/1000.0
ELSE (DATEDIFF(year,@Startdate,@Enddate)-1)+(DATEDIFF(day,DATEADD(year,DATEDIFF(year,@Startdate,@Enddate)-1,@Startdate),@Enddate))/1000.0
END as decimal(9,3))
Far away is close at hand in the images of elsewhere.
Anon.
February 17, 2015 at 2:38 am
sm_iransoftware (2/17/2015)
Thank you allAnd
Thank you David Burrows
I didnot Know Row_Number() Befor this.
Actually ROW_NUMBER was introduced with 2005, you might want to check out the other windowing functions as well, 2014...
Far away is close at hand in the images of elsewhere.
Anon.
February 17, 2015 at 1:26 am
Using row number
SELECT ProductId,ProductConfigId,Amount AS [MinPrice],HasGift
FROM (SELECT p.ID AS [ProductId],c.ID AS [ProductConfigId],a.Amount,c.HasGift,
ROW_NUMBER() OVER (PARTITION BY p.ID ORDER BY a.Amount ASC) AS [RowNum]
FROM dbo.TBL_Product p
JOIN dbo.TBL_ProductConfig c ON c.ProductId = p.ID
JOIN...
Far away is close at hand in the images of elsewhere.
Anon.
February 16, 2015 at 7:20 am
CREATE TABLE dbo.Person (PersonID int,FirstName varchar(20),LastName varchar(20))
CREATE TABLE dbo.Relation (RelationID int,BossID int,SlaveID int)
INSERT dbo.Person VALUES (1,'Bob','Patel'),(2,'Lun','Smith'),(3,'Julie','Taylor'),(4,'Chris','Pain'),(5,'Joe','Bloggs')
INSERT dbo.Relation VALUES (1234,1,3),(321,3,3),(231,1,5)
SELECT p.PersonID,p.FirstName,p.LastName,
STUFF((SELECT ',' + Name
FROM (SELECT DISTINCT s.FirstName + ' ' +...
Far away is close at hand in the images of elsewhere.
Anon.
February 16, 2015 at 7:02 am
Just for fun 😀
SELECT ISNULL(Category,'Total') AS [Category],SUM(Column1) AS [Total]
FROM MyTable
GROUP BY Category
WITH ROLLUP
HAVING Category IS NULL OR Category IN ('Category1','Category2','Category3','Category4')
ORDER BY GROUPING(Category) ASC,Category ASC
Far away is close at hand in the images of elsewhere.
Anon.
February 11, 2015 at 2:11 am
Hint: Use CASE statement for Category and use it in GROUP BY
Far away is close at hand in the images of elsewhere.
Anon.
February 10, 2015 at 10:27 am
Glad you solved it 🙂
Far away is close at hand in the images of elsewhere.
Anon.
February 6, 2015 at 6:13 am
Ooops my bad, I was testing using Value
Why are you using UniqueName, is the report using a cube?
If you put the expression Nazwa pomiaru.UniqueName in another textbox do you get...
Far away is close at hand in the images of elsewhere.
Anon.
February 5, 2015 at 1:49 am
I'm on SQL2008R2 and it work for me
What version are you on?
Far away is close at hand in the images of elsewhere.
Anon.
February 4, 2015 at 8:41 am
OK but like I said it stops inserting before the first record and I presume it's to do with the characters in the field of the first row.
But we cannot...
Far away is close at hand in the images of elsewhere.
Anon.
February 3, 2015 at 10:18 am
Check the XML for hidden characters as this would stop the implicit decimal conversion
Far away is close at hand in the images of elsewhere.
Anon.
February 3, 2015 at 7:46 am
Try
Switch(Fields!Nazwa_pomiaru.UniqueName = "regulacji", "IRSRZGD", Fields!Nazwa_pomiaru.UniqueName = "tryb", "IRSRZGD", True, Nothing)
although I think this will work as well
IIf(Fields!Nazwa_pomiaru.UniqueName = "regulacji" OR Fields!Nazwa_pomiaru.UniqueName = "tryb", "IRSRZGD", Nothing)
Far away is close at hand in the images of elsewhere.
Anon.
February 3, 2015 at 6:25 am
Sum(IIf(DateDiff(DateInterval.Day,Fields!SubmittedDate.Value,Today)>=31 AND DateDiff(DateInterval.Day,Fields!SubmittedDate.Value,Today)<=60,1,0))
Far away is close at hand in the images of elsewhere.
Anon.
February 3, 2015 at 1:43 am
Jeff Moden (1/31/2015)
Far away is close at hand in the images of elsewhere.
Anon.
February 2, 2015 at 6:50 am
Brian Hibbert (2/1/2015)
Far away is close at hand in the images of elsewhere.
Anon.
February 2, 2015 at 6:33 am
Viewing 15 posts - 556 through 570 (of 3,544 total)