Forum Replies Created

Viewing 15 posts - 1,381 through 1,395 (of 1,468 total)

  • RE: Can I do this?

    select

    TABLE_QUALIFIER = DB_NAME()

    , TABLE_OWNER = OBJECT_SCHEMA_NAME(object_id)

    , TABLE_NAME = OBJECT_NAME(object_id)

    , *

    from sys.columns

    where object_id = OBJECT_ID('dbo.WHATEVER_THE_TABLE_IS', 'U')

  • RE: Date issue - when the time portion is 09:59:59.997

    Does this query return the the same value in both columns?

    And is it '2016-10-19 09:59:59.997' or '2016-10-19 10:00:00.997'?

    declare @StartdateTime datetime;

    SELECT TOP 1 @PortsLastEndDate = EndDate

    FROM dbo.BandwidthLogCalculatedTest6

    WHERE PortIndex = 8

    ORDER BY...

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

Viewing 15 posts - 1,381 through 1,395 (of 1,468 total)