Forum Replies Created

Viewing 15 posts - 1,711 through 1,725 (of 1,923 total)

  • RE: GROUP BY Query Help

    Hmm, that would involve a minor tweak in the CTE , andrew... here is the tweaked code..

    ;WITH CTE(Birthdate,ROWID, DATE_COUNT)

    AS

    (

    SELECT Birthdate, MAX(ROWID) , COUNT(Birthdate) FROM [dbo].[Birthdate] GROUP BY Birthdate

    )

    SELECT

    ...

  • RE: combine multiple rows into one dynamically query question

    This might be helpful for some who accidentally tumbles upon this thread 😀

    IF OBJECT_ID('TEMPDB..#CONCAT_COLUMN_VALUES') IS NOT NULL

    DROP TABLE #CONCAT_COLUMN_VALUES

    CREATE TABLE #CONCAT_COLUMN_VALUES

    (

    GROUP_ID INT,

    COL_VAL VARCHAR(5)

    )

    INSERT INTO #CONCAT_COLUMN_VALUES

    SELECT...

  • RE: GROUP BY Query Help

    Andrew, how about this following piece of code??

    ;WITH CTE(Birthdate, DATE_COUNT)

    AS

    (

    SELECT Birthdate, COUNT(Birthdate) FROM [dbo].[Birthdate] GROUP BY Birthdate

    )

    SELECT

    BD.ROWID,BD.Birthdate, BD.FIRSTNAME, CTE.DATE_COUNT

    FROM

    [dbo].[Birthdate] BD

    LEFT JOIN

    ...

  • RE: Alter table on-the-fly

    Good Luck , Trybbe ! 🙂

  • RE: Alter table on-the-fly

    Ronald beat me to it.. but there is a difference between my code and ronald's.. ron's uses cursors, mine doesnt.. and i have also CASE statements to bring out the...

  • RE: Alter table on-the-fly

    trybbe, this below code might do the trick for you..

    IF OBJECT_ID('TEMPDB..#part') IS NOT NULL

    drop table #part

    ...

  • RE: Alter table on-the-fly

    The problem is here buddy

    Trybbe (4/22/2010)


    alter table tmp_Customers add (@Column_Name @Data_Type)

    You cant pass a local variable to DDL statments.. now what u have resorted to using this...

  • RE: Dynamic Query

    One of the local variable is initiated to NUL, buddy... Check up all of your local variables for null and then include them in your dynamice sql..

  • RE: SQL Syntax

    Lynn Pettis (4/21/2010)


    Please note that if you write the query the way Coldcoffee showed you it will not take advantage of any indexes that may exist on your table.

    Guess am...

  • RE: Get email format

    sharonrao123 (4/21/2010)


    Cold coffee made me coolllll 😀

    :blush: Thanks, Shilpa!!! Glad that the code helped and happy that your issue is resolved 😉

  • RE: SQL Syntax

    Buddy, as Lynn said, it really is hard to guess and tell u a solution.. so post ur sample records, ur table structure and desired output..

    But for starters, i will...

  • RE: Get email format

    sharonrao123 (4/20/2010)


    My brian is all hot I am craving for some cold coffee now.

    You wanted a cold-coffee, and here is your coldcoffee presenting you with a cold code :-D!! check...

  • RE: SQLCMD

    Hey there, can you give us the complete command u are trying to execute?

  • RE: Understanding and Using APPLY (Part 2)

    Paul White NZ (4/20/2010)


    I am considering a Part III, to cover some specific cases where APPLY can produce solutions which are more efficient than any other method...we'll see.

    Paul

    Wow, thats a...

  • RE: SQL Server Ranking Functions

    Wonderful article WayneS.. a great read.. taught me new things about Ranking... Thanks 🙂

Viewing 15 posts - 1,711 through 1,725 (of 1,923 total)