Forum Replies Created

Viewing 15 posts - 2,821 through 2,835 (of 8,731 total)

  • RE: What are the advantage of using cross apply over union all?

    mynkdby (5/23/2016)


    What are the advantage of using cross apply over union all?

    They're different operators, they both do different things.

    If you're talking of unpivoting using cross apply or union all. The...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Sorting by a NVARCHAR nullable column

    Not entirely safe, but it could work.

    SELECT *

    FROM #Work

    ORDER BY ISNULL( Activitycode, NCHAR(4600));

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: TSQL

    m.rajesh.uk (5/23/2016)


    Hi All,

    I need a query to get the data on hourly wise. Below query gives data on day basis.

    SELECT

    stat_date AS "date",

    DATEPART(YEAR,stat_date) AS year,

    SUBSTRING(CONVERT(VARCHAR(10),stat_date,102),0,8) AS year_month,

    DATEPART(MONTH,stat_date) AS month,

    DATEPART(WEEK,stat_date) AS week,

    MAX(nb_error)...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Today's Random Word!

    crookj (5/20/2016)


    Ed Wagner (5/20/2016)


    Manic Star (5/20/2016)


    Ed Wagner (5/20/2016)


    yb751 (5/20/2016)


    Ed Wagner (5/20/2016)


    crookj (5/20/2016)


    djj (5/20/2016)


    Manic Star (5/20/2016)


    Ray K (5/20/2016)


    Manic Star (5/20/2016)


    Beautiful (75 and partly cloudy)

    Ugly

    Duckling

    Quack

    Doctor

    Demento

    Shoes

    Running

    Walking

    Tripping

    Texting

    Driving (WRONG!)

    Crashing

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are the posted questions getting worse?

    Ed Wagner (5/20/2016)


    Luis Cazares (5/20/2016)


    Tomorrow there's a SQL Saturday in Atlanta and I can't attend. I'll miss the opportunity to meet Jason B and Wayne S.

    I'll probably have to wait...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are the posted questions getting worse?

    Tomorrow there's a SQL Saturday in Atlanta and I can't attend. I'll miss the opportunity to meet Jason B and Wayne S.

    I'll probably have to wait for next year or...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Assigning max value + 1 to a column

    TheSQLGuru (5/20/2016)


    Luis Cazares (5/20/2016)


    This should fix the concurrency problems, and a few pet peeves I have.

    WITH cte AS (

    SELECT o.*,

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Today's Random Word!

    Manic Star (5/20/2016)


    Beautiful (75 and partly cloudy)

    Ugly

    average Joe

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Split Delimited String Across Fixed Number Of Columns

    Ed Wagner (5/20/2016)


    Luis Cazares (5/20/2016)


    Ed Wagner (5/20/2016)


    You have to love the dynamic crosstab. Nice work, Luis.

    Thank you, Alan.

    This has become simpler each time. It's even better now that I...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Can we reduce the spam?

    Lynn Pettis (5/19/2016)


    Steve Jones - SSC Editor (5/19/2016)


    drew.allen (5/19/2016)


    Would it be possible to limit posts based on the number of visits? I noticed that most of the spam comes...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Split Delimited String Across Fixed Number Of Columns

    Ed Wagner (5/20/2016)


    You have to love the dynamic crosstab. Nice work, Luis.

    Thank you, Alan.

    This has become simpler each time. It's even better now that I have templates for the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Split Delimited String Across Fixed Number Of Columns

    I wouldn't want to write 99 columns, so I would use a dynamic approach for this.

    DECLARE @sql nvarchar(max);

    WITH

    E(n) AS(

    SELECT n FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0))E(n)

    ),

    cteTally(n) AS(

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Using joins in single query question

    Just to be sure, because it's a common confusion. Are you using SQL Server?

    In your post you mentioned autoincrement instead of identity (which is the word used in SQL Server)....

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Assigning max value + 1 to a column

    This should fix the concurrency problems, and a few pet peeves I have.

    WITH cte AS (

    SELECT o.*,

    ISNULL((SELECT...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Query templates

    Try this:

    http://blog.sqlauthority.com/2014/11/29/sql-server-customization-of-new-query-in-sql-server-management-studio/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 2,821 through 2,835 (of 8,731 total)