Viewing 15 posts - 241 through 255 (of 272 total)
doc_sewell (2/17/2010)
Yeah, but that Query designer feature (by right clicking on a table) does not work in SQL 08.
It does for me.
February 17, 2010 at 2:19 pm
Don't know if I can imbed, but if you follow this . . .
February 16, 2010 at 11:51 pm
RBarryYoung (2/16/2010)
Steve Cullen (2/16/2010)
It's just a jump to the left. And then a step to the right. 😛Put your hands on your hips?
...and pull your knees in tight.
February 16, 2010 at 3:41 pm
It's just a jump to the left. And then a step to the right. 😛
February 16, 2010 at 3:08 pm
I'm not really sure what your requirement is. You will need to use some form of dynamic sql.
declare @ColumnName varchar(50)
declare @sql nvarchar(max)
set @ColumnName = 'SalesData_' + convert(varchar(2),datepart(dd,getdate()))
set...
February 12, 2010 at 10:10 am
Give this a shot.
; with Year2010 AS (
Select
AREA,SRC
,case
when DATE between '1/1/2010' AND getdate() THEN 'YTD 2010'
when DATE between '1/1/2009' AND dateadd(yy,-1,getdate()) THEN 'YTD 2009'
else 'Not...
February 11, 2010 at 3:10 pm
Golly!
SELECT
a.Sales[Y09Q4 Sales]
, b.Sales[Y08Q4 Sales]
, (a.Sales - b.Sales) AS [Difference]
FROM sales a
INNER JOIN sales b
ON (b.Yr + 1) = a.Yr
AND b.Qtr = a.Qtr
WHERE a.Yr = 2009
AND a.Qtr =...
February 10, 2010 at 2:08 pm
That's pretty much it. You store and manipulate in datetime format and output/format to a string, usually.
February 10, 2010 at 10:41 am
Something like :
SELECT
a.Yr, a.Qtr, a.Sales, (a.Sales - b.Sales) AS [Difference]
FROM sales a
INNER JOIN sales b
ON (b.Yr + 1) = a.Yr
AND b.Qtr = a.Qtr
WHERE a.Yr = 2010
February 10, 2010 at 10:24 am
OK, it does work. Must test better 🙂
February 10, 2010 at 9:18 am
Well that won't work. In this case I would use two variables based off of the same value such as :
DECLARE @mydate datetime, @mydatestring varchar(20)
SELECT @mydate = getdate()
SELECT @mydatestring...
February 10, 2010 at 9:15 am
You can convert it back to datetime if you need to :
INSERT INTO tableA (columnA)
SELECT CONVERT(datetime,@mydate)
February 10, 2010 at 9:08 am
DECLARE @mydate varchar(20)
SELECT @myDate = CONVERT(CHAR(9),GETDATE(),1) + SUBSTRING(CONVERT(CHAR(5),GETDATE(),14),1,5) + ' '
print @mydate
February 10, 2010 at 8:40 am
We find it handy to keep a static calendar table around with dates and attributes such as IsHolliday and DayOfWeek, Month, Quarter, FiscalYear etc.
Ours starts at 1/1/1900 and goes to...
February 9, 2010 at 9:34 am
Viewing 15 posts - 241 through 255 (of 272 total)