Viewing 15 posts - 6,811 through 6,825 (of 10,144 total)
SELECT TimesheetKey, SiteKey, [Date],
SUMDuration = SUM(Duration) OVER(PARTITION BY SiteKey, [Date], GroupRule), GroupRule
FROM #TIMESHEET
July 29, 2011 at 2:16 am
Walton (7/27/2011)
I think i need to go with the option 1. But I am curious about the hidden ansi character. Would you please explain what is ansi hidden character...
July 28, 2011 at 6:40 am
bopeavy (7/27/2011)
crookj (7/27/2011)
bopeavy (7/27/2011)
--------------------------------------------------------------------------------
Brandie Tarvin (7/27/2011)
--------------------------------------------------------------------------------
bopeavy (7/27/2011)
--------------------------------------------------------------------------------
Ray K (7/27/2011)
--------------------------------------------------------------------------------
WOTD: coffee
Tea
Green
Green green grass of home....
Grass
ERROR -- Does not compute!
It's not unusual.
July 27, 2011 at 7:57 am
Thanks for stepping up Brandie 🙂
I tried it with a 2-column and 3-column output. Since the result sets are both run into the same table, you get a column mismatch...
July 27, 2011 at 6:21 am
Here's an easy way but it depends upon the structure and content of the two result sets:
-- Make a test proc returning 2 result sets
CREATE PROCEDURE dbo.junk AS
SELECT SetID...
July 27, 2011 at 2:29 am
pdanes2 (7/26/2011)
ChrisM@Work (7/26/2011)
That's slick, and definitely going in my toolbox. I never would have guessed that could be done with set-based code.
Thanks! Must admit though, it's borrowed from the teachings...
July 26, 2011 at 6:59 am
DECLARE @WordToCheck VARCHAR(30) = 'SQL SERVER'
SELECT Letter, COUNT(*)
FROM(
SELECT Letter = SUBSTRING(@WordToCheck, n.n, 1)
FROM (SELECT TOP 30 n = ROW_NUMBER() OVER(ORDER BY [Name]) FROM sys.columns) n
WHERE n.n <= LEN(@WordToCheck)
) d
WHERE Letter...
July 26, 2011 at 4:59 am
What datatype is the string?
DECLARE @Variable_Char CHAR(30), @Variable_Varchar VARCHAR(30)
SET @Variable_Char = 'String to measure '
SET @Variable_Varchar = 'String to measure '
SELECT LEN(@Variable_Char), LEN(@Variable_Varchar), DATALENGTH(@Variable_Char), DATALENGTH(@Variable_Varchar)
SELECT LEN(REPLACE(@Variable_Varchar,...
July 26, 2011 at 2:30 am
Decide on the logic then worry about the code. For instance, you could stop traversing if a previous number is reached and use the prior number. You could set a...
July 22, 2011 at 7:05 am
"...on server. It works fine on mine local machine..." - do you mean you have installed a local server and it runs ok there? Are the functions dbo.split the same...
July 22, 2011 at 6:43 am
Dom, can you confirm which version of SQL Server you are connecting to? Cheers.
July 22, 2011 at 5:40 am
rgtft (7/21/2011)
Chris,Wouldn't your SQL miss the case:
Acct2 Sec77 Only in Account
I was playing around with this; that's the only reason I ask.
You're absolutely right, good spot.
July 21, 2011 at 10:32 am
-- Naming a table [Index] is NOT advisable.
SELECT ad.ACCOUNTID, x.SecurityID,
MatchStatus = CASE WHEN a.ACCOUNTID IS NULL THEN 'Only in Index' ELSE 'Matched' END
FROM [INDEX] x
CROSS JOIN (SELECT DISTINCT...
July 21, 2011 at 9:52 am
Not much information to go on.
Run the following code and post back comments.
SELECT
OrgCode AS UnitState ,
OrgCode As State,
COUNT(*) AS Rows_Per_OrgCode
--IsNull(Count(*), 0) As [SLRP Approved]
FROM tLookup_StateTable...
July 21, 2011 at 4:53 am
Try this - IN and appropriate OUT on the same row:
;WITH SequencedData AS (
SELECT *,
PersonID = DENSE_RANK() OVER(ORDER BY strLastName, strFirstName),
rn = ROW_NUMBER() OVER (ORDER BY strLastName, strFirstName, datAdded)...
July 21, 2011 at 3:09 am
Viewing 15 posts - 6,811 through 6,825 (of 10,144 total)