Forum Replies Created

Viewing 15 posts - 5,026 through 5,040 (of 15,381 total)

  • RE: Second Last work day of month

    Or if you don't need the flexibility of a calendar table (which is probably what I would use) and you don't care about holidays you could do some simple date...

  • RE: Get 1st Word in the string

    Eirikur Eiriksson (5/1/2014)


    A simple solution

    😎

    with p as

    (

    select 'asdf1234' as Delivery_Site union all

    select 'asdf 1234' union all

    select ' asdf asdf ' union all

    select ''

    )

    ,TXT_INFO AS

    (

    SELECT

    ...

  • RE: In-Line Function to split string

    Just an fyi...the code you posted is what is known as a multi statement table valued function (mstvf). These are very poor performers. In fact, a typical scalar function or...

  • RE: Are the posted questions getting worse?

    Steve Jones - SSC Editor (5/1/2014)


    Can someone do me a favor and try to edit a few of their own posts?

    got a report of a bug here: http://www.sqlservercentral.com/Forums/Topic1566649-433-1.aspx?Update=1

    See my reply...

  • RE: Every forum post has an ///Edit button

    Steve Jones - SSC Editor (5/1/2014)


    That's certainly a bug if it's happening.

    All your posts should be editable by you only and I use this button at least weekly....

  • RE: Get 1st Word in the string

    Eirikur Eiriksson (5/1/2014)


    Why not try Jeff Moden's splitter, pass space as delimiter?

    😎

    Try it...

    with p AS

    (

    SELECT 'asdf12345678901' AS Delivery_Site UNION

    SELECT 'asd f 234 ...

  • RE: Get 1st Word in the string

    gbritton1 (5/1/2014)


    Here's an approach using Chris Morris Pattern Splitter:

    select Delivery_Site, firstword.Item

    from p

    cross apply (

    select top 1 * from dbo.PatternSplitCM(Delivery_Site, '%[a-z0-9]%')

    where Matched = 1

    order by ItemNumber

    ) firstword

    [/url]

    This certainly works but I...

  • RE: Get 1st Word in the string

    Good catch below86. The introduction of multiple spaces really messes up that code I posted.

    Some people do have problems posting code. It is often their firewall that prevents it. At...

  • RE: forming a dynamic query

    Two major issues with the way you are writing this. The first and the biggest issue is this is wide open to sql injection. You should NEVER directly execute a...

  • RE: Truncate before table drop

    I would think that it is actually slower. Both truncate and drop will deallocate pages. These page deallocations are what is logged in a truncate and a drop. This basically...

  • RE: How to use an optimization for all operations in sp_executesql?

    jdk77 (5/1/2014)


    Hi

    I have a C# solution with many parameterized sql queries.

    I would like to be able to add optimizations to these in a centralized way.

    For the sake of simplicity, let's...

  • RE: Why Use Error Handling?

    dhechle (4/30/2014)


    I have always believed best practice when writing stored procedures or any SQL code is to include error handling. I was challenged today though as to why include...

  • RE: Tried to dynamically create schema, GO separator is not recognized

    SQL Guy 1 (4/30/2014)


    I need to create a schema in every database, and here is my code that I try to execute dynamically:

    DECLARE @stmt NVARCHAR(MAX)=

    'use DBApps

    GO

    CREATE SCHEMA Obsolete...

  • RE: Database Design - Need help in Choosing a primary key

    Bill Talada (4/30/2014)


    Guids are my preference; I never said they were gospel truth. The difference between guids and identities is that identities get generated on insert whereas guids can...

  • RE: Get 1st Word in the string

    sharonsql2013 (4/30/2014)


    No Worries, Found a Link that helped.

    LTRIM(LEFT(p.Delivery_Site, CHARINDEX(' ',p.Delivery_Site)))

    I don't think that will actually work in all situations.

    with p as

    (

    select 'asdf1234' as Delivery_Site union all

    select 'asdf 1234' union all

    select...

Viewing 15 posts - 5,026 through 5,040 (of 15,381 total)