Forum Replies Created

Viewing 15 posts - 2,941 through 2,955 (of 8,731 total)

  • RE: Case Pivot Table inside Function

    Glad you got it.

    BEGIN...END is only needed when a function has multiple statements. Multiple statement table-valued functions are bad for performance, while inLine table-valued functions won't affect performance and would...

  • RE: Case Pivot Table inside Function

    fergfamster (4/29/2016)


    Just FYI, this is the function I tried.

    The function you tried has no RETURN. All functions need to return something.

    Also, ORDER BY is not allowed in functions and views,...

  • RE: Case Pivot Table inside Function

    fergfamster (4/29/2016)


    hi Guys, Gals-

    I have the following query which works well. However, changing this to reside inside a table function has been challenging. Any suggestions?

    --===== Suppress the auto-display of rowcounts...

  • RE: Please help with CURSOR - My 1st attempt and learning.

    As part of personal experience, I would suggest to get away from cursors for this thing. Making complex calculations one row at a time will slow down your system in...

  • RE: Case Statement in Order By

    cmick 77911 (4/29/2016)


    I would turn it into a column and order by it. Cleaner this way.

    SELECT

    (CASE WHEN AddDt > UpdateDt

    THEN AddDt

    ELSE ISNULL(UpdateDt, AddDt)

    END) AS MaxDt,

    Id, Name,...

  • RE: Looking to "hack" the "Script As DROP"

    Brandie Tarvin (4/29/2016)


    HA! Even SSMS agrees I have too many jobs. Using just a part of the code from Lowell's second link (to create the drop job stuff), I got

    An...

  • RE: Please help with CURSOR - My 1st attempt and learning.

    To start on why it stays in an infinite loop, you have the Set @AutexCount before the begin, so this is the only statement running as a loop without any...

  • RE: Today's Random Word!

    Ed Wagner (4/29/2016)


    djj (4/29/2016)


    ThomasRushton (4/29/2016)


    whereisSQL? (4/28/2016)


    TomThomson (4/28/2016)


    Revenant (4/28/2016)


    Ed Wagner (4/28/2016)


    Recorder

    Flute

    Whistle

    Dog

    Food

    Bacon

    Goodness

    Divine

  • RE: Looking to "hack" the "Script As DROP"

    Just to be sure, I like to use the quotename function.

    SELECT 'IF EXISTS (SELECT 1 FROM msdb.dbo.sysjobs_view WHERE name = N' + QUOTENAME( name, '''') + ')

    ...

  • RE: Count the number of hours between two dates

    yb751 (4/28/2016)


    Luis beat me to the sample data speech...but that being said I would advise not to use ordinal position in your ORDER BY clause. It's a bad habit...

  • RE: Count the number of hours between two dates

    Please post some sample data (no need for real data) and expected results based on that data. To know how this is needed read the articles in my signature.

    This is...

  • RE: Today's Random Word!

    Ray K (4/28/2016)


    crookj (4/28/2016)


    Revenant (4/28/2016)


    DonlSimpson (4/28/2016)


    TomThomson (4/28/2016)


    ZZartin (4/28/2016)


    crookj (4/28/2016)


    Flash

    Levitt

    Fresnel

    Lighthouse

    Dressing

    Russian

    Cossack

    Corsair

  • RE: Passing table name as parameter into SP

    Learner44 (4/28/2016)


    Only one question now!!

    How I can become like you pro in SQL

    Please answer. I am ready to do whatever it takes.

    BY the way that solution worked fine.

    Read blogs, articles...

  • RE: Passing table name as parameter into SP

    An alternative to John's nice query.

    ALTER PROCEDURE Doc124NEW_new (@DMIGRATIONNEW nvarchar(128)) --Objects can only have 128 characters. Could use sysname instead.

    AS

    SET NOCOUNT ON;

    -- SET NOCOUNT ON added to prevent extra result...

  • RE: Count differs while using the date values

    tindog (4/28/2016)


    Did the queries Luis provided not work? What happened?

    An alternative would be to change your parameters to DATE instead of DATETIME, then use BETWEEN as you have (without the...

Viewing 15 posts - 2,941 through 2,955 (of 8,731 total)