Forum Replies Created

Viewing 15 posts - 871 through 885 (of 897 total)

  • RE: Problem in Join Query

    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...

  • RE: Avoid dynamic SQL

    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...

  • RE: Problem in Join Query

    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...

  • RE: SARGable

    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:-)

  • RE: value extraction

    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 +...

  • RE: need help to build a query

    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 )...

  • RE: Set a Variable Inside a Case Statement

    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...

  • RE: Set a Variable Inside a Case Statement

    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...

  • RE: Create multiple rows with single row splitting the data from one field

    You can also have a look at http://www.sqlservercentral.com/Forums/Topic870949-338-1.aspx

    which has the solution to a similar problem

  • RE: Best example of grouping ???

    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.

  • RE: HELP. multipart identifier could not be bound

    You are right Jeff. Even i don't think the query needs to be dynamic. Making it simple might solve the whole problem.

  • RE: Query

    Glad that i could help you out...:-)

  • RE: Query

    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...

  • RE: Query

    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 *...

  • RE: How to Delete Right 3 Characters from a string

    Try this if this works..

    UPDATE Table SET Column = REPLACE( Column, RIGHT(Column, 3), '' )

Viewing 15 posts - 871 through 885 (of 897 total)