Viewing 15 posts - 871 through 885 (of 897 total)
It does work in my PC though...
Check this out
WITH cteProduct AS
(
SELECT1 ProductID, 'Maruti' ProductName, 1 CategoryID UNION ALL
SELECT2, 'Scoda', 1 UNION ALL
SELECT3, 'Benz', 1
), cteDescriptors AS
(
SELECT1 DescriptorValueID, 'Black' DescriptorValue UNION...
February 26, 2010 at 11:29 pm
There are people who love "Dynamic SQL". I being one of them. How can one forget the "Dynamic Cross Bars" and the "Dynamic Pivots". Dynamic SQL is really useful in...
February 26, 2010 at 10:59 pm
Check if this satisfies your requirement..
SELECTProductName
FROM(
SELECT P.ProductName, COUNT(*) MappedCount
FROM ProductDescriptorMapping PDM
INNER JOIN Product P ON PDM.ProductID = P.ProductID
GROUP...
February 26, 2010 at 10:48 pm
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:-)
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 +...
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 )...
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...
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...
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
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.
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.
February 18, 2010 at 10:37 pm
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 *...
February 15, 2010 at 11:11 pm
Try this if this works..
UPDATE Table SET Column = REPLACE( Column, RIGHT(Column, 3), '' )
January 22, 2010 at 10:03 am
Viewing 15 posts - 871 through 885 (of 897 total)