Viewing 15 posts - 256 through 270 (of 287 total)
Yeah, I think the approach is fine. I was just messing around with some junk so I thought I'd share my code (obviously the Date table I am using is...
June 18, 2009 at 12:53 pm
The basics are Entities, Attributes and Relationships. Can you define all the Entities? Without knowing all the details I can see Policy, Question and Answer. Are there other entities? What...
June 18, 2009 at 11:55 am
Perhaps some sample data an expected output would help:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
June 18, 2009 at 9:39 am
For fun here is a one more way using a LEFT OUTER JOIN:UPDATE
T
SET
speccode = ''
FROM
#Test AS T
LEFT OUTER JOIN
(
select speccode, MAX(dateentered) AS MaxDate
from #test
group by speccode
) AS D
ON T.SpecCode...
June 17, 2009 at 4:50 pm
Carl Federl (6/17/2009)
June 17, 2009 at 4:35 pm
I would assume that applying functions to the "cph.cbTransEffectiveDate" columns is causing the performance issues. Can you describe in more detail what you are trying to do? Are you just...
June 17, 2009 at 3:33 pm
Here is another way:UPDATE
T
SET
SpecCode = ''
FROM
(
SELECT SpecCode, ROW_NUMBER() OVER (PARTITION BY SpecCode ORDER BY DateEntered DESC) AS RowRank
FROM #Test
) AS T
WHERE T.RowRank > 1
EDIT: I'm getting lazy and didn't...
June 17, 2009 at 3:12 pm
The ROW_NUMBER() fucntion is probably the way to go, but if you have the option to create the table you can use an IDENTITY INSERT INTO:SELECT 'SPC-'+OptionGroup+'-'+RTrim(cast(pid as varchar(6))),
'NEM','SPC-'+OptionGroup,IDENTITY(INT,1,1) as...
June 17, 2009 at 2:33 pm
Although SQL Server manifests a PK as an index, and thus has performance implications. Additionally, FKs also have some overhead associated with them.
However, PKs and FKs have nothing to...
June 17, 2009 at 1:00 pm
I cannot remeber if this was fixed in a patch, but SQL200 used to have issues with BIT columns. You might want to re-run your tests by CASTing the literal...
June 17, 2009 at 12:04 pm
Hopefully, this address your question, but you should also read up on what transactions are/do.
When you put the TRANS at the top SQL has to do a lot of...
June 15, 2009 at 1:29 pm
I'm not sure why you'd need to move those values into variables, unless you are converting your query to one that takes paramamters. Additionally, using a split function to populat...
May 18, 2009 at 11:34 am
One more for fun:SELECT RIGHT('0' + CAST(MONTH(CURRENT_TIMESTAMP) AS VARCHAR(2)), 2)
May 15, 2009 at 5:03 pm
FelixG (5/15/2009)
Vrachar type removes trailing spaces... you must use the CHAR type
For what it is worth, SQL doesn't remove trailing spaces when inserting into a VARCHAR. Rather, SQL ignores them...
May 15, 2009 at 3:25 pm
Viewing 15 posts - 256 through 270 (of 287 total)