Forum Replies Created

Viewing 15 posts - 3,241 through 3,255 (of 4,085 total)

  • RE: Date Format to String

    Using datapart, you'll lose the leading zeros. Convert it to the format closest to what you want and then clean it up using REPLACE.

    SELECT REPLACE(REPLACE(REPLACE(CONVERT(varchar(25), GETDATE(), 120), '-', ''),...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: error

    Please do not create duplicate posts for the same topic. It fragments the replies. Please respond in this thread. http://www.sqlservercentral.com/Forums/Topic1281038-392-1.aspx

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: CTE Usage

    GilaMonster (4/11/2012)


    Semicolons are statement terminators, as such they should terminate statements, not start them. We don't start sentences in English with fullstops.

    T-SQL is a completely different language from English with...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Shifting values to the left

    If the ultimate goal is concatenation, then there's no reason to shift columns left. Just do the concatenation as normal.

    with mySampleData (id,addr1,addr2,addr3)

    AS

    (

    SELECT'1','123',NULL,'Main St.' UNION ALL

    SELECT'2',NULL,NULL,NULL UNION ALL

    SELECT'3',NULL,'345','Elm St.'...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Help with an IF ELSE statement

    Part of the problem is that the OP specified a particular route to the destination when only the destination is important. There are really only three conditions:

    Between Friday at...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a looping subquery whose result set is used by parent? do I use a CTE?

    There are just too many variables to recommend one approach over another. You'll need to test several different approaches to see which one works best with your data.

    A table...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SELECT... COLLATE doesn't work with an IN clause

    Henry Treftz (4/6/2012)


    Jean, I guess the first question is why do you want to force case and accent sensitivity? It will ignore the index on the field and hurt...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a looping subquery whose result set is used by parent? do I use a CTE?

    A CTE is part of the following INSERT, SELECT, or UPDATE statement and does not exist outside of that scope. If you need to use the same set of...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: a looping subquery whose result set is used by parent? do I use a CTE?

    Sorry, misread the SQL.

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Shredding with XQuery to Parent, Child, Grandchild tables

    Jeff Moden (4/5/2012)


    I guess that I'm still amazed that such a simple structure requires 3 selects to return the hierarchy.

    It doesn't. As with almost everything, there are multiple ways...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: T-SQL to DMX

    I think you mean MDX. You cannot directly translate SQL to MDX. Even though there are some superficial similarities, they are completely different languages, because they query completely...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SSIS - Importing data file and creating .csv outbound file

    SSIS requires that each of the records have the same structure. Since your header records have a different structure than your detail records, you can't do this directly in...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: how to delete all except results of select statement

    Here is another possibility. Since you haven't provided test data, it's difficult to compare the various methods. This method only scans the table once, but has more logical...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: FK referencing PK in *same* table

    Jeff Moden (3/30/2012)


    Heh... a Rose, by any other name, is still a Rose.

    Unless I'm mistaken, all of the examples above all boil down to some form of parent/child relationship.

    I'm not...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Joining tables with two tables but displayed in only one row

    Use FOR XML PATH('') to concatenate your string together. There are several articles on how to do this. In my quick scan, this covered the basics well. Creating...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,241 through 3,255 (of 4,085 total)