Viewing 15 posts - 46 through 60 (of 168 total)
IF OBJECT_ID('tempdb..#CountsPerHour') > 0 DROP TABLE #CountsPerHour
CREATE TABLE #CountsPerHour
(Dept int, UserId int, StartTime datetime)
INSERT INTO #CountsPerHour
SELECT 1, 10, '2012-07-30 08:52' UNION ALL
SELECT 1, 10, '2012-07-30 09:52' UNION ALL
SELECT...
August 1, 2012 at 3:01 am
IF OBJECT_ID('tempdb..#CountsPerHour') > 0 DROP TABLE #CountsPerHour
CREATE TABLE #CountsPerHour
(Dept int, UserId int, StartTime datetime)
INSERT INTO #CountsPerHour
SELECT 1, 10, '2012-07-30 08:52' UNION ALL
SELECT 1, 10, '2012-07-30 09:52' UNION ALL
SELECT...
July 31, 2012 at 7:01 pm
OK, figured it out ... needed OUTPUT
IF OBJECT_ID('tempdb..#Sample') > 0 DROP TABLE #Sample
CREATE TABLE #Sample
(Student varchar(20), Grade int, Selected int)
INSERT INTO #Sample
( ...
June 14, 2012 at 8:36 pm
This is as simple as a question as I can come up with for this.
Can I get the DECLARE out of the @sql area?
How can I get SELECT...
June 14, 2012 at 1:45 pm
SELECT TOP 1 B.Student FROM #Worked B) WHERE Tag = 0
Need to get rid of the parenthesis?
Having problems after this executes, would like to be able to:
SELECT @UseIt
June 13, 2012 at 5:27 pm
This is Andrew's solution which is very interesting. I get two errors when I excute this:
Msg 137, Level 15, State 1, Line 1
Must declare the scalar variable "@UseIt".
Msg 156,...
June 13, 2012 at 5:07 pm
Dwain, looks good, thanks
June 13, 2012 at 7:31 am
Anthony thanks. The concept of this looks like something I can understand.
I copied and pasted this exactly as written but I get two errors:
must declare scalar variable...
June 13, 2012 at 7:22 am
I'm going to work on it in a bit, will probably do it in a few steps using temp tables then join.
May 13, 2012 at 9:39 am
Desired result:
--pulling result for one IdNum, one RepDate and one IdRule
DECLARE @IdNum varchar(10)
SET @IdNum = '1001'
DECLARE @RepDate varchar(10)
SET @IdNum = '20120511'
DECLARE @IdRule varchar(10)
SET @IdRule = 'xx1'
Result:
IdNum Date ...
May 13, 2012 at 2:23 am
Three different solutions to consider, thank you. The plot thickens on the number of tables and some curve balls on the joins, table not exactly the same.
-- 3...
May 13, 2012 at 2:22 am
I'm sorry. Basically what I have is one transaction type that is a S, it does not have an amount. The A type transactions have the amount. ...
March 13, 2012 at 8:50 am
In that temp table there is a field called "source"
One record has the value "S," that is the record that needs to be updated (using a self join)
March 13, 2012 at 8:30 am
Viewing 15 posts - 46 through 60 (of 168 total)