Forum Replies Created

Viewing 15 posts - 3,646 through 3,660 (of 8,731 total)

  • RE: T-SQL split string and Pivot

    Other than using a different function, the final code is basically the same. The only problem is that you're not using the fastest function available (even in the article Aaron...

  • RE: Transaction count after EXECUTE in a stored procedure - ERROR

    You're commiting your transaction twice. Once in the try and once in the catch. Remove one of them to correct the issue.

    For the second post, you have an open transaction...

  • RE: T-SQL split string and Pivot

    I'm not sure why do you want a pivot.

    Note that this code will only work with up to 4000 chars. If you don't have unicode values, you could use the...

  • RE: how extract values from expressions

    The DelimitedSplit8K is a great tool, but you might find useful to use another tool to reduce the code.

    This tool is the Pattern Splitter created by Chris Morris and posted...

  • RE: How to Get SQL to Change Date is Time Goes Past Midnight.

    I did something slightly different from Lowell's.

    CREATE TABLE #Shifts(

    StartShift time,

    EndShift time

    )

    INSERT INTO #Shifts

    VALUES( '21:00', '06:00'),

    ( '06:00',...

  • RE: SELECT last not null date

    Probably a cross tab could do the trick:

    SELECT ID,

    MIN( CASE WHEN String LIKE 'Rejected%' THEN Date1 END) AS [Rejected on],

    MAX( CASE WHEN...

  • RE: Please help on a Column search

    No problem. Just try to be clear on what you need as much as possible.

    We get confused if you suddenly change the requirements without explaining the reason or saying it...

  • RE: Parse string from URL between...

    Sean Lange (12/9/2015)


    I like this approach but not sure why it is safer. It is easier to maintain for sure since it removed the duplicate charindex function.

    It doesn't rely on...

  • RE: Please help on a Column search

    cswittmaack (12/9/2015)


    Luis

    I did not create the table, I know they are hexadecimal numbers.

    All I want to do is pull the records that are Decimal numbers not the hexadecimal numbers.

    Just use...

  • RE: Parse string from URL between...

    This should be safer.

    declare @URL varchar(100) = 'http://www.mydomain.info/Customer.aspx?dcc=EUR&h_hmid=2907831&mobiredirect=no&cpn=3790'

    SELECT *, LEFT( initial.pos, CHARINDEX( '&', initial.pos + '&') - 1)

    FROM (VALUES (@URL)) AS x(url)

    CROSS APPLY (SELECT SUBSTRING( x.url, CHARINDEX('h_hmid=', x.url) + 7,...

  • RE: Please help on a Column search

    cswittmaack (12/9/2015)


    I would not want to pull record 3 and 4 from the table, and at some time later i might have to only pull records like 3 and 4...

  • RE: Will it be possible to get SQL 2016 Developer Edition?

    The Developer Edition should be available when the product is completely released. Right now, you want to use the CTP version which is a free preview for evaluation.

  • RE: SQL syntax please ?

    You might need this:

    SELECT *

    FROM sys.tables t

    JOIN sys.schemas s ON t.schema_id = s.schema_id

    where t.name = 'STHMCDPTD'

    AND s.name = 'CMS'

    Or this:

    SELECT *

    FROM sys.tables t

    where t.name = 'STHMCDPTD'

    AND SCHEMA_NAME(t.schema_id) = 'CMS'

    Or for...

  • RE: Please help on a Column search

    Depending on the collation, that might not work correctly. Try this:

    CREATE TABLE#alpha_numerics(alpha_numeric VARCHAR(30));

    WITH

    E(n) AS(

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

    ),

    E2(n) AS(

    SELECT a.n FROM E...

  • RE: separate bad data from valid data

    arkiboys (12/9/2015)


    Luis Cazares (12/9/2015)


    I would define the columns from the text file as strings, then use a data conversion or derived column transformation to change the columns' types. That transformation...

Viewing 15 posts - 3,646 through 3,660 (of 8,731 total)