Forum Replies Created

Viewing 15 posts - 5,791 through 5,805 (of 8,731 total)

  • RE: Insert rows into a table without dropping it

    Just to be clear on what Phil is commenting.

    There's a big difference between SELECT...INTO... and INSERT INTO...SELECT...

    The first option will create a table, the second one will just insert rows....

  • RE: Help Needed to Convert Numeric Value to CHAR(7)

    Am I missing something here? Wouldn't a simple LEFT() do the job?

    WITH SampleData AS(

    SELECT RAND(object_id) * 1000 N

    FROM sys.all_columns

    )

    SELECT N, LEFT( N,...

  • RE: How can I run this query for the current days business?

    Without knowing how to identify the Current Day's business, I just can help by leaving this article:

    http://www.sqlservercentral.com/blogs/lynnpettis/2009/03/25/some-common-date-routines/

    That way you don't need to hardcode the date.

    To transfer directly to quickbooks, you...

  • RE: Where's the Thread?

    Maybe The Thread just took some days off to enjoy some BBQ. 😀

  • RE: Nvarchar Time Calculation

    You shouldn't be storing times as nvarchar. SQL Server has a time datatype (and plenty others datetime types).

    We also have the function DATEDIFF available so we don't have to reinvent...

  • RE: Long running MERGE

    I need to wait for some maintenance tasks to complete (including moving the instance to a not-shared node). After everything completes, I'll give it a try. That was exactly my...

  • RE: Long running MERGE

    The row counts are normal, the normal run should be in under 20 minutes but sometimes it takes really long time to complete.

    The column is not needed, but it doesn't...

  • RE: Long running MERGE

    I'm not sure if this is enough:

    Memory 524278 MB

    Processors 80

    cost threshold for parallelism5

    max degree of parallelism4

    Version Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64) Jun 28 2012...

  • RE: Issue with CTE

    You're not referencing your CTE on your UPDATE statement. Additionally, you don't have anything to make a relationship (and that's caused by the previous reason).

    You don't actually need a CTE,...

  • RE: Are the posted questions getting worse?

    Ed Wagner (9/19/2014)


    HanShi (9/19/2014)


    GilaMonster (9/19/2014)


    Someone's either having the worst day, or is asking interview questions.

    Database goes into Restoring mode

    Performance tuning it so critical can any one plz figure it...

  • RE: Find weekdays between 2 dates

    The "Lazy N" was really a mistake on my part. I was going to change it into something descriptive, but I forgot to do it before copying the code.:blush:

  • RE: Find weekdays between 2 dates

    N stands for "Nothing in particular" 😀

    I support your code if it's accompanied by the proper comments describing what it does. I'm not trying to be pedantic, this is more...

  • RE: Pivoting Question

    I haven't tested the following code but it should give you an idea.

    With Rownums AS(

    SELECT *,

    ...

  • RE: Find weekdays between 2 dates

    It's easy when you have the code to generate the Tally Table available.

    Do you know what is a tally table? How is it built here?

    To know more about it, read...

  • RE: Find weekdays between 2 dates

    Something like this could do the trick and you can convert it into an inline table valued function which would be as fast as the normal query.

    DECLARE @Start date =...

Viewing 15 posts - 5,791 through 5,805 (of 8,731 total)