Viewing 15 posts - 796 through 810 (of 1,923 total)
thbaig1 (5/4/2011)
ColdCoffee (5/4/2011)
1. UNPIVOT your columns - this will be dynamic as u...
May 4, 2011 at 2:51 pm
Using GSquared's sample data, is this what you are trying to acheive?
SELECT DATEADD( DD , DATEDIFF(DD,0,DT) ,0) Days ,
MAX(Int1) Int1_Mx,
...
May 4, 2011 at 1:02 pm
DSR0308 (5/4/2011)
that is correct. I am just looking to get two days sales...Yestrerday Sales (becasue im reporting of a datawarehouse) and same time last yeear.
Then the query i gave you...
May 4, 2011 at 12:23 pm
Ninja's_RGR'us (5/4/2011)
DimDate.FeeWeekEndDate > DATEADD(D, 0, DATEDIFF(D, 0, GETDATE())) AND DimDate.FeeWeekEndDate < DATEADD(D,...
May 4, 2011 at 12:05 pm
Ninja's_RGR'us (5/4/2011)
WHERE (
DATEADD( DD , DATEDIFF(DD,0,DimDate.FeeWeekEndDate ),0) = @ThisDayLastYR
OR
...
May 4, 2011 at 11:55 am
SQLRNNR (5/4/2011)
You might want to change the variable in the first case statement to be @Today
Yep, Jason is right. Post edited to correct the error.
May 4, 2011 at 11:53 am
As Ninja put it, the solution might not be an efficient one. Can be done in 3 parts.
1. UNPIVOT your columns - this will be dynamic as u don't know...
May 4, 2011 at 11:51 am
Try this:
DECLARE @Today DATETIME = DATEADD( DD , DATEDIFF(DD,0,GETDATE()),0),
@ThisDayLastYR DATETIME
SELECT @ThisDayLastYR = DATEADD( YEAR , -1,@Today)
select @Today , @ThisDayLastYR
SELECT
DimGeography.GeographyKey,
DimGeography.Country,
DimGeography.GeneralRegion,
DimGeography.LocalRegion,
DimGeography.City,
tblStore.Longitude,
tblStore.Latitude,
DimDate.Year,
DimDate.Month,
DimDate.FeeWeek,
DimDate.FeeWeekEndDate,...
May 4, 2011 at 11:44 am
For starters, you can use
1. GROUP BY with MAX(CASE END) to get a row turned into columns
2. CROSS APPLY twice (or once) to get rows added as columns to...
May 4, 2011 at 11:29 am
Hey YSL, with 649 points to your name, you sure must be knowing how to post your question so that you get maximum response. Please post sample data as INSERT...
May 4, 2011 at 11:26 am
You want to get Sales Information for last year or this year or both?
May 4, 2011 at 11:16 am
Convert the amount column to VARCHAR(x) and concatenate the dollar symbol.. am not aware of any direct methods for that..
May 3, 2011 at 8:26 pm
piotrka (5/2/2011)
Try thisCREATE TABLE [dbo].[Test_1](
[String1] [nchar](100) NULL,
[String2] [nchar](100) NULL
) ON [PRIMARY]
insert into dbo.Test_1
select 'P:\SQL Database Backups\Transaction Logs\',
'\AdventureWorks_TransLog_201105021530.trn'
select LEFT(string1, LEN(string1) - 1) + LTRIM(string2)
from Test_1
Hi piotrka, try your...
May 2, 2011 at 4:32 pm
Lowell query:
SELECT CASE WHEN RIGHT(ThePath,1) <> '\' THEN ThePath ELSE REVERSE(SUBSTRING(REVERSE(ThePath),2,100)) END + CASE ...
May 2, 2011 at 3:43 pm
AndrewSQLDBA (5/2/2011)
But I am not at all sure why you are including all the UNION All statements. And using a CTE method.
Those UNION ALL are not part of the replace...
May 2, 2011 at 3:42 pm
Viewing 15 posts - 796 through 810 (of 1,923 total)