Viewing 15 posts - 136 through 150 (of 1,228 total)
dwilliscp (6/4/2015)
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'case'.
My...
June 4, 2015 at 12:13 pm
You can use CASE in the OVER clause:
OVER (ORDER BY CASE WHEN @var=1 THEN Orderno ELSE Invoiceno END)
Edit: typing on fone on train
June 4, 2015 at 10:39 am
GilaMonster (6/3/2015)
What, other than the NOLOCK hints, is the problem?
The OP is confused by the location of the ON clauses. Since there are only INNER joins, I don't think it...
June 3, 2015 at 2:52 pm
douglas.allison1 (6/2/2015)
Hi All,I am running a sproc we have developed and I am getting a -6 as a returned value does anyone know what that actually means.
TIA
Doug
Only the developer who...
June 2, 2015 at 11:55 am
This should be straightforward - fetch the top row from the customer table (ordered by LastUpdated) and any row from MessageTypeTrack which matches the filter criteria. I think the optimiser...
April 18, 2015 at 4:19 am
If you look at nodes 15 and 16 the actual and expected rowcounts are very different. The plan doesn't appear to be a good fit for this costcentre as it...
April 15, 2015 at 2:16 pm
Rowcounts in the actual and estimated plans are very different - do you know anything about statistics updates in the database?
April 15, 2015 at 1:02 am
brad.pears (4/2/2015)
April 7, 2015 at 5:08 am
George Wei (3/28/2015)
Our system runs a SQL Server 2012 DB, it has a table (table_a) which has over 10M records. Our system have to receive data file from previous...
March 29, 2015 at 1:38 am
SELECT [Out] = t.n+h.n+d.n
FROM (VALUES (1000),(2000),(3000),(4000),(5000),(6000),(7000),(8000),(9000)) t (n)
CROSS JOIN (VALUES (100),(200),(300),(400),(500)) h (n)
CROSS JOIN (VALUES (10),(20),(30),(40),(50)) d (n)
ORDER BY [Out];
WITH rs AS (SELECT * FROM (VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9)) d (n))
SELECT [Out]...
March 29, 2015 at 1:32 am
Eirikur Eiriksson (2/18/2015)
ChrisM@Work (2/18/2015)
SELECT
a.[Pax ID],
a.[Flight Date],
a.[Flight Number],
[Last Mod Date] = CASE WHEN x.[Pax ID] IS NULL THEN a.[Last Mod Date] ELSE x.[Last Mod Date] END,
[Status] = CASE...
February 18, 2015 at 10:32 am
Velveeta22 (2/14/2015)
I have updated the data set and DECLARE variables in my posts. Thank you for those tweaks!
You're welcome - and thanks for the updates. I won't get near...
February 14, 2015 at 8:32 am
Velveeta22 (2/13/2015)
This will install a sample db, tables and some objects. I put around 20 rows of anonymized data in each table:...[/code]
Thanks for this - there are a few...
February 14, 2015 at 2:32 am
Velveeta22 (2/13/2015)
Not the CROSS APPLY, but the CROSS JOIN in [t4].
That's the one. The WHERE clause at the end of all the queries turns it into an inner join. You...
February 13, 2015 at 2:57 pm
Viewing 15 posts - 136 through 150 (of 1,228 total)