Forum Replies Created

Viewing 15 posts - 4,981 through 4,995 (of 8,731 total)

  • RE: Query to find distinct multiple instances of a pattern in a string

    Maybe the DelimitedSplit8k will be faster as there's no really a need for wildcards.

    http://www.sqlservercentral.com/articles/Tally+Table/72993/

    SELECT SUBSTRING( Item, 3, CHARINDEX( '#', Item, 3) - 3) AS keyword,

    '[' + LEFT( Item, CHARINDEX(...

    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: Strange occurance with script

    You made changes to your update statements to merge them into one, but got lost with some logic.

    Update Asgnmnt

    Set DateAcknow =@ClosedDate,

    TimeAcknow=@ClosedTime,

    WhoAcknow =@ClosedBy,

    DateResolv = @ClosedDate,

    TimeResolv = @ClosedTime,

    WhoResolv = @ClosedBy

    Where CallId =...

    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: Datediff

    Do you have an index on Time_Created?

    DATEDIFF will only execute once for the whole query, so it's probable not your problem.

    By the way, you might be wanting to use DATEADD(day,...

    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: Delete statement suggestion that will help me fix my statement

    Just to be clear. There are 2 datetime formats that won't be affected by SET DATEFORMAT.

    One for dates only: 'yyyymmdd'

    And one for datetime values: 'yyyy-mm-ddThh:mi:ss.sss'

    Both comply with ISO 8601 formats...

    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: SQL - Where Row_Number = 1 discussion

    I'm not sure if it's a better solution but it's an alternative that you could test.

    SELECTDISTINCT

    [FirstName]

    ,[LastName]

    ,[Team]

    ,[TransactionID]

    ,FIRST_VALUE([Price]) over (partition by firstname, Transactionid order by price desc) Price

    FROM [Test].[dbo].[Team]

    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: Performance problems with bulk insert command

    It depends on what you're inserting. Does all the information needs to be available at the same time? You could do inserts on batches to prevent long times during blocking.

    If...

    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: Need to stack/transpose one row w/3 fields to a single column

    And just to give a second option.

    WITH X(TotalAllCustomersOnFile,TotalConsumersWithValidEmail,TotalConsumersWithValidEmailAndOptedIn) AS

    (SELECT * FROM (VALUES ('2,500', '1,750', '1,500')) AS X(TotalAllCustomersOnFile,TotalConsumersWithValidEmail,TotalConsumersWithValidEmailAndOptedIn)

    )

    SELECT

    XY.Audience

    ,XY.Totals

    FROM X

    UNPIVOT

    ( Totals...

    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: Performance problems with bulk insert command

    Aren't you using a staging table to prevent problems?

    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: Somebody explain Checkpoint to me

    2 things:

    If you only have the DELETE and the SET inside your transaction, you don't need an explicit transaction.

    If you're going to use explicit transactions, you should use TRY...CATCH blocks...

    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: COALESCE in Left Join

    DonlSimpson (4/29/2015)


    Luis Cazares (4/29/2015)


    chgn01 (4/29/2015)


    How about use ISNULL?

    -- Q3

    SELECT

    *

    FROM

    #abc a

    ...

    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: COALESCE in Left Join

    chgn01 (4/29/2015)


    How about use ISNULL?

    -- Q3

    SELECT

    *

    FROM

    #abc a

    ...

    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: The number of variables declared in the INTO list must match that of selected columns.

    This is the FOR XML version that Lynn previously commented.

    You can find more information in here: http://www.sqlservercentral.com/articles/comma+separated+list/71700/

    DECLARE @strSQL Varchar(MAX) = '';

    WITH FinalDBleverluser(dbname, username) AS (

    Select

    dbname,

    ...

    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 with longest range

    r_slot (4/28/2015)


    Hello Luis,

    I am not feeling offended, just appreciating your remarks. What you are saying is that I should use varchar(40) instead of nvarchar(max). Normally I do that but in...

    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 with longest range

    Lynn, I'm curious.

    What where you expecting to do with the Years and Tally CTEs? I'm sure that you included them for your tests, but I'd love to know what...

    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: Hi, first post! Interested in "Calls"

    Hi there,

    I'm not sure if you're clear on the purpose of stored procedures and functions. If you're used to common programming languages, you'll find out that stored procedures are very...

    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 - 4,981 through 4,995 (of 8,731 total)