Forum Replies Created

Viewing 14 posts - 1 through 15 (of 15 total)

  • RE: BCP error -Unable to open BCP host data-file

    Jeff Moden (1/8/2016)


    sql_only (1/8/2016)


    Jeff Moden (1/8/2016)


    sql_only (1/8/2016)


    I want to import data to my database via bcp like this

    bcp mydb.dbo.mytable in 'C:\_value_.txt' -S mypc\instancename -T

    But the error I keep getting is...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: BCP error -Unable to open BCP host data-file

    Jeff Moden (1/8/2016)


    sql_only (1/8/2016)


    I want to import data to my database via bcp like this

    bcp mydb.dbo.mytable in 'C:\_value_.txt' -S mypc\instancename -T

    But the error I keep getting is unable to open...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: BCP error -Unable to open BCP host data-file

    I want to import data to my database via bcp like this

    bcp mydb.dbo.mytable in 'C:\_value_.txt' -S mypc\instancename -T

    But the error I keep getting is unable to open BCP host data...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Selecting a decimal

    Phil Parkin (1/6/2016)


    sql_only (1/6/2016)


    Phil Parkin (1/6/2016)


    sql_only (1/6/2016)


    was missing DECIMAL(18,16)...

    Might as well use (19,16) or (19,17) – same space occupied on disk (ref. here).

    Yes you're right.

    I have had to settle...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Selecting a decimal

    Phil Parkin (1/6/2016)


    sql_only (1/6/2016)


    was missing DECIMAL(18,16)...

    Might as well use (19,16) or (19,17) – same space occupied on disk (ref. here).

    Yes you're right.

    I have had to settle with 2 though,...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Selecting a decimal

    was missing DECIMAL(18,16)...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Using User Defined functions with SQL Window operations

    DECLARE @tb_correlation TABLE (cl_time DATETIME,cl_first DECIMAL,cl_second DECIMAL)

    --insert your data

    ;WITH te_correlation

    AS

    (

    SELECT cl_time,

    POWER(RANK() OVER (ORDER BY cl_first)-RANK() OVER (ORDER BY cl_second),2) AS corr

    FROM @tb_correlation

    ORDER BY cl_time

    OFFSET 0 ROWS

    )

    SELECT

    cl_time,

    SUM(corr) --apply windowing here

    FROM...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Using User Defined functions with SQL Window operations

    Hugo Kornelis (1/5/2016)


    I am sorry to hear that the CLR aggregate does not support the newer windowing extensions. But you are right that this invalidates the idead and that it...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Using User Defined functions with SQL Window operations

    It turns out that even if this UDA is assembled, it can only be used with partition by in the over clause.

    Will seek a strictly sql solution, no longer need...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Using User Defined functions with SQL Window operations

    It is a pity SQL Server has no inbuilt aggregate functions for correlation. 😉 I have to build one from scratch.

    My function takes two columns so I will need to...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Using User Defined functions with SQL Window operations

    TheSQLGuru (1/3/2016)


    Scalar UDFs are HORRIBLY HORRIBLY BAD!!! Take the logic out and either inline it in your SELECT or make it an INLINE Table Valued Function and go with that....

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Using User Defined functions with SQL Window operations

    Eirikur Eiriksson (1/3/2016)


    This is not possible in this way, the over clause cannot be used with user defined functions.

    😎

    Okay thanks, no wonder there is nothing online about this

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Omitting 'DISTINCT'

    Yes there is, not only in terms of performance but it's also more legible and maintainable

    Edit: Replaced a local variable with a CTE, close to 50% improvement in performance;-)

    Thank you...

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂
  • RE: Omitting 'DISTINCT'

    How would I use CROSS APPLY in this case?

    You're all familiar with 'there's an app for that'... here's another... there's a CTE for that! 🙂

Viewing 14 posts - 1 through 15 (of 15 total)