Viewing 15 posts - 1 through 15 (of 32 total)
daveriya (10/21/2011)
hii have this code in where clause RTRIM(LTRIM(ODER_ID))= ' ',WHAT THis do
It's just removing extra blank spaces, but this is un-necessary as SQL views empty strings as empty strings...
October 23, 2011 at 8:06 am
Ok it runs for me but I made my own 'datasource' table so the data may be differnt.
Please post DDL and sample data from the table we are running these...
October 22, 2011 at 12:32 pm
This statement:
when Convert(nvarchar(255),Left(A.Comments,Charindex('|', A.Comments,1)-1)) < 0
is what is giving your error.
You are doing a less than comparison between nvarchar data and an integer here.
I assume you mean to return...
October 22, 2011 at 8:09 am
Do you have any way to relate the rows in the table to the ones in the file?
October 19, 2011 at 3:41 pm
SELECT CASE WHEN ROW_NUMBER() OVER (ORDER BY object_id) > 1 THEN 'UNION ALL ' ELSE '' END +
'SELECT * FROM '...
October 19, 2011 at 3:27 pm
You can return the partition ID this way:
$partition.partitionFunctionName(partitionColumn)
October 8, 2011 at 7:42 pm
I think I see what's happening now, its taking the amount as opposed to the calculated amount so for the first two rows coincidentally it was correct but once you...
October 6, 2011 at 7:03 pm
WITH CTEDATE AS (
SELECT DATEADD(DAY,num-2,(SELECT MIN(transDATE) FROM transTest)) [date]
FROM dbo.Nums
WHERE num <= DATEDIFF(DAY,(SELECT MIN(transDATE) FROM transTest),(SELECT MAX(transDATE) FROM transTest)) + 2
),CTEAMT AS (
SELECTrow_number() over(order by b.[date]) [rownum]
,B.[date]
,isnull(SUM(amount),0) [amt]
FROM transTest A
RIGHT...
October 6, 2011 at 7:01 pm
Lynn Pettis (10/6/2011)
Based on the sample data what is your expected results and what are the criteria?
Hi Lynn, run this to see expected result set based on sample data.
SELECT '2011-10-02...
October 6, 2011 at 2:59 pm
You can do cumulative totals using a correlated subquery.
SELECT id,dt,amt,(SELECT SUM(amt) FROM #t b WHERE a.id = b.id AND a.dt >= b.dt)
FROM #t a
October 6, 2011 at 5:03 am
Hi can you post some DDL with some test data, I think I know a way to do this but I'd like to verify it with your data if possible.
October 6, 2011 at 4:36 am
Very nice!
Yeh Im not sure why I didnt have the partition by FK_ID, I think when I was initially testing it I put a WHERE clause in the first CTE...
October 6, 2011 at 2:43 am
EDIT:
Scratch that, doesn't quite work after verifying the data. But I will leave it up, maybe someone can use it as a basis to get it 100% correct. I will...
October 5, 2011 at 6:58 pm
Grant Fritchey (10/5/2011)
chandan_jha18 (10/5/2011)
But as you(Paul and Grant) mentioned about posted date...
October 5, 2011 at 6:04 pm
You're safe to remove Microsoft SQL Server 2008 as that looks like its the Express instance you installed.
Everything which says 2008R2 is part of the second instance you installed (the...
October 2, 2011 at 6:05 pm
Viewing 15 posts - 1 through 15 (of 32 total)