Viewing 15 posts - 226 through 240 (of 2,007 total)
sivaj2k (6/27/2013)
declare @table table (id int identity(1,1),item varchar(10),amt int)
insert into @table values (1,100),(2,200),(3,300),(4,400)
declare @sumtotal int
select @sumtotal = SUM(amt) from @table
SELECT a.id, a.amt,@sumtotal-SUM(b.amt)
FROM ...
June 27, 2013 at 6:22 am
Sample data: -
IF object_id('tempdb..#testEnvironment') IS NOT NULL
BEGIN;
DROP TABLE #testEnvironment;
END;
SELECT TOP 10000 IDENTITY(INT,1,1) AS ID,
(ABS(CHECKSUM(NEWID())) % 1000) + 1 AS usage
INTO #testEnvironment
FROM master.dbo.syscolumns sc1, master.dbo.syscolumns sc2,...
June 27, 2013 at 4:01 am
mamzy10 (6/27/2013)
June 27, 2013 at 3:18 am
Firstly, whenever you come on a technical forum you should always try to provide people with DDL and readily consumable sample data. This makes people far more willing to answer...
June 26, 2013 at 9:27 am
Can't really explain why, but change the function to: -
CREATE FUNCTION [dbo].[func_SPLIT_STRING]
(@INPUT VARCHAR(8000)
,@DELIMITER CHAR(1) = '|'
)
And...
June 26, 2013 at 8:23 am
ArjunaReddy (6/24/2013)
Environment: SQL Server 2008 Enterprise Edition with sufficient hardware.
I have a table with > 60 Million records on which I am performing delete operation using a stored...
June 24, 2013 at 1:47 am
Since we're talking about SQL Server 2008 here, any issue with using the date type?
SELECT CONVERT(DATE, DateAdd(yy, - 5, GetDate()));
June 24, 2013 at 1:45 am
ashwinboinala (6/20/2013)
thanks for u r time getting below errorMsg 208, Level 16, State 0, Line 10
Invalid object name '#validdatesasints'.
For you to have got that error, you must've not run...
June 20, 2013 at 9:27 am
Simon Hardstaff (6/19/2013)
Thanks Cadavre that did the trick thank you very much 🙂
Bear in mind that if your Row_ID is not contiguous, you need to use the ROW_NUMBER solution propose...
June 19, 2013 at 8:23 am
You're over complicating things. This is just a bit of simple maths 😉
-- CREATE SAMPLE DATA
IF object_id('tempdb..#Table') IS NOT NULL
BEGIN
DROP TABLE #Table;
END;
SELECT TOP 30
ROW_NUMBER() OVER(ORDER...
June 19, 2013 at 8:13 am
Teee (6/19/2013)
I need to return the minimum date from my table and manipulate it so it starts from the first of the month
e.g 2012-06+'-'+'01+ and use this as...
June 19, 2013 at 5:06 am
Another couple of ways: -
-- IF FROM A TABLE
SELECT fin
FROM (VALUES('[N] 18. Is the C.B. removed from the panel? [Yes / No]')
)a([STRING])
CROSS APPLY (SELECT...
June 5, 2013 at 7:29 am
First, let's create some sample data from the mess that you posted: -
IF object_id('tempdb..#test') IS NOT NULL
BEGIN;
DROP TABLE #test;
END;
SELECT [Job Posting Create Date_JP], [Report Run Date_BYR]
INTO...
May 29, 2013 at 9:15 am
Brandie Tarvin (5/28/2013)
May 28, 2013 at 8:34 am
ChrisM@Work (5/15/2013)
dwain.c (5/15/2013)
My gut was telling me an rCTE wouldn't do it and the set-based loop I...
May 15, 2013 at 8:44 am
Viewing 15 posts - 226 through 240 (of 2,007 total)