Viewing 15 posts - 2,836 through 2,850 (of 10,144 total)
frdrckmitchell7 (10/24/2014)
Hi ChrisThanks in advance....
No problem. Can you confirm that you are using SQL Server 2008?
October 24, 2014 at 4:10 am
Can you post the actual code you are using?
October 24, 2014 at 3:47 am
jeff.born (10/23/2014)
That worked, I knew there had to be a better way and that is it.
Not so fast...ROW_NUMBER() over a whole table is expensive. Scott's method is usually far more...
October 24, 2014 at 2:14 am
The sample customer matches two rows in the postcodes table:
SELECT
c.SHORT_POSTCODE,
c1.SHORT_POSTCODESquish,
x.StartPostCodeSquish,
x.EndPostCodeSquish,
CASE WHEN c1.SHORT_POSTCODESquish BETWEEN x.StartPostCodeSquish AND x.EndPostCodeSquish THEN 'Match' ELSE '' END
FROM h_Customer c
CROSS APPLY (SELECT SHORT_POSTCODESquish...
October 23, 2014 at 9:49 am
vee_jess (10/23/2014)
Chris,This seems to be doing the trick :). I will carry on testing and will either mark this as answered or come back with more questions.
Thank you very much.
Excellent...
October 23, 2014 at 9:28 am
pnr8uk (10/23/2014)
...in the input table I have a postcode BETWEEN two values eg: CV1 and CV10 I want to get a third value from the look up table. ...
There won't...
October 23, 2014 at 7:52 am
This is interesting. If you order by a column name then the expected result is returned. If you order by an ordinal position, 1 or 2, you get an error...
October 23, 2014 at 7:44 am
Have you checked that you're reading from data and not cache, in each case?
http://en.helpdoc-online.com/powerbuilder_9.0/source/pbugp154.htm
October 23, 2014 at 5:48 am
Some more sample data would probably make sense. Have a play with this and see how you get on:
-- Amended function
ALTER FUNCTION [dbo].[IF_Calendar] (@Enddate DATE)
RETURNS TABLE AS RETURN
WITH
e1...
October 23, 2014 at 4:45 am
vee_jess (10/22/2014)
As a title will be best please.
Also, please note that I need to report on data October,November and December 2012,2013 and 2014. Now, I will get
4...
October 23, 2014 at 1:37 am
Luis Cazares (10/22/2014)
Did you leave something out of your post? There seems to be no reason to have the 3 left joins in that query as it is.
Without DISTINCT, those...
October 23, 2014 at 1:30 am
vee_jess (10/22/2014)
Absolutely. A Month (and probably a year) on the report will be good. The dataset will contain October, November, December data for 2012,2013 and 2014 so it will probably...
October 22, 2014 at 9:42 am
vee_jess (10/22/2014)
Thank you so much, seems to be doing the job however, the will be a broader dataset and more months. I would these records to the sample dataset
('2012-12-03','DM1','Monday',441),
('2012-12-03','DM3','Monday',10),
('2012-12-10','DM4','Monday',25),...
October 22, 2014 at 8:12 am
No problem. First, put the calendar code into a function:
CREATE FUNCTION [dbo].[IF_Calendar] (@Enddate DATE)
RETURNS TABLE AS RETURN
WITH
e1 AS (SELECT d.n FROM (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) d (n)),
e2 AS (SELECT a.n...
October 22, 2014 at 7:32 am
Viewing 15 posts - 2,836 through 2,850 (of 10,144 total)