Viewing 15 posts - 241 through 255 (of 395 total)
Luis Cazares (9/26/2012)
Laurie, you should drop the else from your cases to allow negative numbers.
Good idea - I've dropped a bit of excess code too, based on the other suggestions...
DECLARE...
September 26, 2012 at 8:50 am
How about this?
WITH CTE AS
(
SELECT rownum, Value
FROM
(
SELECT rownum = row_number() over (order by (select null)), *
FROM @tab
) x
CROSS APPLY (values (case when flag1=1 then value1 else 0 end),
(case when...
September 26, 2012 at 8:31 am
It looks as though dup is a copy of NestleComments.
Assuming this is so:
The subquery gets the minimum PK for the comment. This is joined to NestleComments on PK. ...
September 26, 2012 at 8:10 am
Try this:
-- Start & End of Fiscal Year:
declare @StartDate Date, @DateInt int, @DateEndInt Int;
set @StartDate = '01 Apr 2012'; -- Start Date of Fiscal Year
set @DateInt = datediff(dd, 0, @StartDate);...
September 26, 2012 at 6:26 am
Nested REPLACE is very efficient, so there will not be a faster way.
September 26, 2012 at 5:47 am
The usual solution for this is a recursive CTE.
Look at
http://www.sqlservercentral.com/articles/Development/recursivequeriesinsqlserver2005/1760/
for example.
If you post some proper test data it will be easier for people to help!
Also, do you want help designing...
September 26, 2012 at 3:59 am
Here's a possible solution:
-- Start & End of Fiscal Year:
declare @StartDate Date, @DateInt int, @DateEndInt Int;
set @StartDate = '01 Apr 2012'; -- Start Date of Fiscal Year
set @DateInt = datediff(dd,...
September 26, 2012 at 3:34 am
Perry Whittle (9/25/2012)
SQLSACT (9/25/2012)
I have a quick question regarding pages moving from disk into memory
If I select * from a table, are all pages that make up the table...
September 25, 2012 at 9:19 am
This does though, with small adjustments:
DECLARE @s-2 VARCHAR(10)
SET @s-2 = 'tapsaw1'
SELECT SUBSTRING(@s,t2.number,t1.number-(t2.number-1))--,t2.number,t1.number-(t2.number-1)
FROM master.dbo.spt_values t1
INNER JOIN master.dbo.spt_values t2 ON t2.type='P' AND t2.number BETWEEN 1 AND t1.number
WHERE t1.type='P' AND t1.number BETWEEN 1...
September 25, 2012 at 7:58 am
Mark-101232 (9/25/2012)
DECLARE @s-2 VARCHAR(10)
SET @s-2 = 'tapsaw1'
SELECT SUBSTRING(@s,t2.number,t1.number)
FROM master.dbo.spt_values t1
INNER JOIN master.dbo.spt_values t2 ON t2.type='P' AND t2.number BETWEEN 1 AND t1.number-1
WHERE t1.type='P' AND t1.number BETWEEN 1 AND...
September 25, 2012 at 7:02 am
If your table is not very big, you could SELECT * FROM Table using 'Results to Text' instead of grid, then copy & paste the output to a text file.:-D
September 25, 2012 at 4:52 am
This process uses the 'Quirky Update' without the essential requirements being in place. As such it is unreliable & will almost certainly give incorrect results in the future (or...
September 25, 2012 at 4:45 am
bcsims 90437 (9/24/2012)
SQLRNNR (9/21/2012)
opc.three (9/20/2012)
moving-partspartly-moving
WD40
UB40
September 24, 2012 at 9:42 am
1. Using
RTRIM(LTRIM(SD.Code ))<>''
will be very slow - if you've got an index on SD.Code it probably won't be used. Can you tidy the data in the table so you don't...
September 24, 2012 at 8:02 am
Viewing 15 posts - 241 through 255 (of 395 total)