Viewing 15 posts - 871 through 885 (of 895 total)
I noticed it only now. The first option has a column in the Where Clause. It must be a typo for sure. Anyways i got it right:-)
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 26, 2010 at 12:23 am
Try the following..
DECLARE@strString VARCHAR(100)
DECLARE@strDelimiter VARCHAR(1)
DECLARE@iPosition1 INT
DECLARE@iPosition2 INT
SELECT@strString = 'C-P-M-T-U-R',
@strDelimiter = '-',
@iPosition1 = CHARINDEX( @strDelimiter, @strString ),
@iPosition2 = CHARINDEX( @strDelimiter, @strString, iPosition1 + 1 )
SELECT SUBSTRING( @strString, @iPosition1 +...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 25, 2010 at 12:41 am
See if this works..
; WITH cteDBDetails AS
(
SELECT ROW_NUMBER() OVER ( PARTITION BY dbname ORDER BY dbdate DESC ) RDesc,
ROW_NUMBER() OVER ( PARTITION BY dbname ORDER BY dbdate ASC )...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 24, 2010 at 2:36 am
Glad that i could help you:-). But make sure you read the link i had provided. The article has a detailed explanation of the method and the situations when this...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 24, 2010 at 12:42 am
See if this helps..
IF OBJECT_ID( 'tempdb..#tmpMyTable' ) IS NOT NULL
DROP TABLE #tmpMyTable
DECLARE@iGroupID INT
SET@iGroupID = 1
SELECT*, NULL AS GroupID
INTO#tmpMyTable
UPDATE#tmpMyTable
SET@iGroupID = GroupID = CASE WHEN CategoryNumber = '101010111414' THEN @iGroupID + 1...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 23, 2010 at 10:45 pm
You can also have a look at http://www.sqlservercentral.com/Forums/Topic870949-338-1.aspx
which has the solution to a similar problem
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 23, 2010 at 10:04 pm
Did you go through the links provided by Paul??
I don't think you will get any simpler examples than that. The Craig Freedman's Blog is pretty simple and easy to understand.
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 22, 2010 at 3:23 am
You are right Jeff. Even i don't think the query needs to be dynamic. Making it simple might solve the whole problem.
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 18, 2010 at 10:37 pm
Glad that i could help you out...:-)
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 16, 2010 at 2:43 am
Yes. It should work fine even for larger tabes with proper indexes. But i would suggest you to test with proper data before coming to any conclusion.. Your query would...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 16, 2010 at 2:05 am
See if this works...
DECLARE @strUserName VARCHAR(100)
SET @strUserName = 'U2'
; WITH cteUserMapping AS
(
SELECT*
FROMUser U
WHERE EXISTS( SELECT * FROM WorkSpace W WHERE W.FK_User = U.ID )
), cteUserMappingDetails AS
(
SELECT*
FROMEvent
WHERE NOT EXISTS( SELECT *...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 15, 2010 at 11:11 pm
Try this if this works..
UPDATE Table SET Column = REPLACE( Column, RIGHT(Column, 3), '' )
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 22, 2010 at 10:03 am
Try this. This works for the data provided. You can do additional changes for any other data.
create table #x
(phno int,
Description varchar(20),
qty int,
amt money)
insert into #x values(123,'abc',1,60)
insert into #x values(123,'abc',-1,60)
insert into...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
December 7, 2009 at 11:18 am
Even this should work, say the name of table is Employees and the name of the column is DateOfJoin.
SELECT*
FROM Employees
WHEREDATEPART( DAY, DATEADD( DAY,...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
December 7, 2009 at 9:58 am
Well. I never thought it can be done this way. Thanks for the additional info Ramesh.
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
April 6, 2009 at 12:32 pm
Viewing 15 posts - 871 through 885 (of 895 total)