Forum Replies Created

Viewing 15 posts - 1,351 through 1,365 (of 1,435 total)

  • RE: Dynamic rows into columns

    ChrisM@Work (10/20/2016)


    Can your week numbers go beyond 53?

    Good catch Chris. I completely overlooked the fact that we are looking at weekly sales :doze:

    Chris is on the right path. ...

  • RE: Computed column storage size

    CferMN (10/19/2016)


    DesNorton (10/19/2016)


    A computed column is not stored, therefor there is no need to be concerned about the size. HOWEVER, SQL has to recompute the value every time that...

  • RE: Computed column storage size

    A computed column is not stored, therefor there is no need to be concerned about the size. HOWEVER, SQL has to recompute the value every time that it is...

  • RE: Dynamic rows into columns

    seismicbeat (10/19/2016)


    Hello,

    Sorry for bothering you again. I have a couple of questions about putting the dynamic pivot results to a local table or view. I think, I can use INTO...

  • RE: Dynamic rows into columns

    seismicbeat (10/18/2016)


    @DesNorton, thank you so much for your help, the link you've provided above was pretty handy and helped me in understanding how I do it.

    So, I came up with...

  • RE: Dynamic rows into columns

    Take a look at the accepted reponse at "http://stackoverflow.com/questions/10404348/sql-server-dynamic-pivot-query"

    You will need to replace "date" with your list of static columns (product, area, etc)

  • RE: finding the current ID value compared to the IDENTITY value

    PearlJammer1 (10/17/2016)


    Hi Jeff

    It is because we have a situation where some tables appear to have id values less than the current identity value which will get auto generated on next...

  • RE: finding the current ID value compared to the IDENTITY value

    The only way I can think of is to loop through the tables and check each one

    CREATE TABLE #TableList (

    ID ...

  • RE: Difference between purchase dates in days

    ByronOne (10/14/2016)


    Yes, I worked out to add the customer join - eventually!

    Any thoughts on how I could measure the date difference between the first ever order of a given customer...

  • RE: Difference between purchase dates in days

    ByronOne (10/14/2016)


    Yes, I worked out to add the customer join - eventually!

    Any thoughts on how I could measure the date difference between the first ever order of a given customer...

  • RE: Difference between purchase dates in days

    John Mitchell-245523 (10/13/2016)


    This should get you started. You'll need to tweak it, even if only to get the 0 for the first date.WITH NumberedDates AS (

    SELECT

    Customer

    ,PurchaseDate

    ,ROW_NUMBER() OVER (PARTITION BY...

  • RE: Evaluate each field from source to target and update

    hegdesuchi (10/13/2016)


    Hi,

    We cannot have hash because target table does not have it. we cannot alter the target table.

    Can we do this by dynamic updates?

    i.e. I want to check if...

  • RE: Using SP in UDF

    Sergiy (10/12/2016)


    Try this approach:

    ALTER VIEW vSeedData

    AS

    SELECT RAND(CHECKSUM(NEWID())) Seed

    GO

    alter FUNCTION [GenerateRandomDateTime]

    (

    @MinimumDate DATETIME,

    @MaximumDayDifference INT,

    @MaximumSecondsFromMidnight INT

    ) RETURNS DATETIME

    BEGIN

    RETURN(SELECT TOP 1 DATEADD(DAY, Seed * ISNULL(@MaximumDayDifference, 365), @MinimumDate) + DATEADD(SECOND, Seed...

  • RE: t-sql 2012 update primary key value into column of the second table

    wendy elizabeth (10/11/2016)


    I like your idea of using the output clause from the insert statement. However, I will still have the same problem of trying to obtain the unique lockid...

  • RE: t-sql 2012 update primary key value into column of the second table

    wendy elizabeth (10/11/2016)


    The insert statements are on my original post. The example I showed you is an example of what I want the output to look like. Would you give...

Viewing 15 posts - 1,351 through 1,365 (of 1,435 total)