Forum Replies Created

Viewing 15 posts - 6,271 through 6,285 (of 8,731 total)

  • RE: How can I strip Leading zero's from a string?

    Maybe something like this could work?

    WITH SampleData AS(

    SELECT '00345.0001' code UNION ALL

    SELECT '02345.0123' code UNION ALL

    SELECT '025013'

    )

    SELECT ISNULL(...

    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: Counting the characters in a string before a space

    cbrammer1219 (6/12/2014)


    No that didn't work, all it did was return NULL values for every column 1 through 10

    Well, that's not what I've got using the data that you posted.

    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: Counting the characters in a string before a space

    I noticed that you didn't only have spaces and you have tabs as well.

    Would this help you?

    SELECT MAX( CASE WHEN ItemNumber = 1 THEN LTRIM(Item) END) Col1

    ...

    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: Surrounding proc definitions with BEGIN ... END

    tim.berry 88829 (6/12/2014)


    Should really be a begin try with a subsequent error handling begin catch

    I'm not sure that I would like to have a single try block for complex procedures.

    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: Developers vs. DBAs

    simon.crick (6/12/2014)


    jfogel (6/12/2014)


    simon.crick (6/12/2014)


    Tavis Reddick (6/12/2014)


    [p]I am having some difficulty understanding the categorizations of roles used here.

    [/p][p]My understanding of a database administration role is close to Wikipedia's, where a DBA...

    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: Find Customers Who Bought "A" and "B" But Not "C" (SQL Spackle)

    The Wizard Of Oz (6/12/2014)


    Luis Cazares (6/12/2014)


    But that won't work to find customers that bought A & C but not B. 😀

    Haha! Yes Luis, good thing that A & C...

    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: Find Customers Who Bought "A" and "B" But Not "C" (SQL Spackle)

    The Wizard Of Oz (6/12/2014)


    For a miniscule (and mostly academic) improvement on PeSo's script,

    I've got it so the index/table only gets scanned once (instead of 3 times)

    by just using 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: Counting the characters in a string before a space

    cbrammer1219 (6/12/2014)


    This doesn't work for what I am wanting, it is counting the spaces, It doesn't count the characters before the spaces, as you see in the data below for...

    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: Counting the characters in a string before a space

    I just wanted to play a little bit with the DelimitedSplit8k and this is what came out.

    CREATE FUNCTION [dbo].[ItemsLength]

    (

    @pString [varchar](8000),

    @pDelimiter [char](1)

    )

    RETURNS...

    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: Import Numbers with '-' or scientific notation

    What's the data type on the table for those values? string or numeric?

    Have you tried formatting the columns correctly before converting them to csv?

    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 help to finding pattern

    I missed the question. What's your problem?

    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 csv records to seperate columns

    Where do you have those csv values?

    In a file? a parameter? a table?

    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: Turn Off Delete

    I'm not so sure about this, but you could deny delete on your tables/schema. http://technet.microsoft.com/en-us/library/ms176128.aspx

    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: Find Customers Who Bought "A" and "B" But Not "C" (SQL Spackle)

    mushin2003 (6/11/2014)


    Luis Cazares (6/11/2014)


    Hi Rob,

    The problem with your first query is that you missed to add the join condition for the CustomerID. In result, you're getting a cross join between...

    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: Replace a special charecter in results

    You're on the right direction. You just need to quote your characters/strings. 😉

    SELECT ProdID, REPLACE (PATH, '/', '\')

    FROM (SELECT 1 AS ProdID, '/folder/folder/file' AS [PATH])blahblah

    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 - 6,271 through 6,285 (of 8,731 total)