Viewing 15 posts - 1,681 through 1,695 (of 2,007 total)
--First, lets build some test data
DECLARE @table AS TABLE (mydate DATETIME)
;WITH testdata AS (
SELECT CAST('2011-01-01' AS DATETIME) datevalue, 1 AS counting
...
April 26, 2011 at 3:01 am
I realise this is old, but I found it useful today.
I modified the code: -
;WITH stored_procedures AS (
SELECT
o.name AS proc_name, oo.name AS table_name,
ROW_NUMBER() OVER(partition by o.name,oo.name ORDER BY o.name,oo.name)...
April 19, 2011 at 9:02 am
Assuming davidandrews13 has guessed correctly about how you determine the "subsequent" row, then his idea is sound. You can run the update statement straight from the CTE - e.g.
;WITH...
April 19, 2011 at 6:41 am
Can you provide readily consumable test data, please?
e.g., from your first post: -
DECLARE @table AS TABLE
(id INT, [type] VARCHAR(10), amt INT)
INSERT INTO @table
SELECT 101, 'Cash', 100
UNION ALL SELECT 101, 'Credit',...
April 18, 2011 at 3:36 am
SELECT *
FROM dbo.tvwcontractview
WHERE businessunit = 'Property_DATA_LIBRARY'
AND book = 'Property - Live'
AND [Type] =...
April 15, 2011 at 8:42 am
Craig Farrell (4/14/2011)
I'm going to assume I'm just too...
April 14, 2011 at 1:54 am
Look up Pivot.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]
April 14, 2011 at 1:51 am
Please bear in mind that when I said "work experience lad", I meant a 15 year old school kid. In the UK that means the extent that school had taught...
April 7, 2011 at 9:10 am
And just in case you intend to do all of your date formatting in SQL (it's a presentation layer task imo, so should be done in the front end code...
April 7, 2011 at 8:57 am
WITH weekdays
AS (SELECT CONVERT(DATETIME, Dateadd(dd, -Datepart(dw, Getdate()), Getdate())+1) AS startofweek,
...
April 7, 2011 at 8:47 am
karen.blake (3/31/2011)
And as per usual thank you so much it...
April 1, 2011 at 4:32 am
karen.blake (3/30/2011)
Thanks for replying. I did wonder if this might be the problem so I took the floor out but a)this hasn't changed the value and b) my problem...
March 30, 2011 at 7:32 am
In case someone else ends up in a similar position, here is what I've decided.
I'm going to have him design and write a very simple inventory system, allowing us to...
March 28, 2011 at 3:47 pm
An alternative would be to cast as a BIGINT.
e.g.
DECLARE @phonenumber VARCHAR(12), @areacode VARCHAR(5), @countrycode VARCHAR(2)
SET @phonenumber = '367894'
SET @areacode = '04252'
SET @countrycode = '61'
SELECT
CAST(CAST(REPLACE(REPLACE(LTRIM(RTRIM(@countrycode)),'-',''),' ','') AS BIGINT) AS VARCHAR(2))...
March 28, 2011 at 4:14 am
OK. It'd be an ambiguous column error if you were to join these hypothetical tables on the IDs.
March 22, 2011 at 4:32 am
Viewing 15 posts - 1,681 through 1,695 (of 2,007 total)