Forum Replies Created

Viewing 15 posts - 5,101 through 5,115 (of 8,731 total)

  • RE: Help with finding multiple Character Occurence in String

    Alan.B (3/24/2015)


    Luis Cazares (3/24/2015)


    This is a quick idea.

    WITH Letters AS(

    SELECT TOP 26 CHAR(ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) + 64) letter

    FROM sys.all_columns

    )

    SELECT DISTINCT...

    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: Help with finding multiple Character Occurence in String

    Here are my 2 options. Just wanted to note that I added an id to force order and that Jeff could be considered a false positive for a cleanup process.

    CREATE...

    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: Help with finding multiple Character Occurence in String

    This is a quick idea.

    WITH Letters AS(

    SELECT TOP 26 CHAR(ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) + 64) letter

    FROM sys.all_columns

    )

    SELECT DISTINCT n.*

    FROM #Names...

    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: Want to return character(s) after a dash (-)

    Alan's solution can be simplified by using the length of your column instead of calculations. You could also achieve it with the STUFF function (just for fun).

    DECLARE @x TABLE (yourvalue...

    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: ONLY sysadmin permissions

    Other than overriding any security configuration, as sysadmin can't be denied any permissions. Most permissions are assigned to different roles, just not at the same time. You could even grant...

    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: Vendor Changed the Flat File Format

    Assuming that you're using SSIS and your main problem is that your fifth/last column is including unwanted columns, I would suggest that you use a derived column to use only...

    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: Stuck with SQL can you help?

    You have to correct your join clause. Your HAVING clause has an issue as well.

    SELECT parentName, count(*)

    FROM parents p --Alias parent table

    JOIN children c --Alias children 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: Validate URL

    I'd go with the ping option as a validation before inserting in the table.

    Would this be a valid URL http://www.thisisaninvalidurl.com? It has the correct format but won't get you anywhere.

    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 in simple query

    As previously stated, you're getting a join on matched rows only. The problem is that your first row on table A matches both rows on table B and the second...

    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 Help: Running row Total with Thresholds.

    pietlinden (3/18/2015)


    Okay, what version of SQL Server are you using, because this has zero to do with SSIS? This works in 2012, and I think in 2008.

    This is 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: Update with Recursive CTE?

    Or using replicate to know how many zeroes you're using without counting them. It's a matter of personal preference.

    SELECT RIGHT(REPLICATE('0', 10) + RTRIM( YOUR_ACCOUNT_NUMBER), 10)

    FROM (SELECT CAST( ABS(CHECKSUM(NEWID())) % 10000000...

    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: HELP evaluating rows and selecting specific records

    Don't thank me until you fully understand it.

    There are lots of articles that talk about gaps and islands problems, some of them show better solutions performance wise but I like...

    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: HELP evaluating rows and selecting specific records

    Do you realize that this is a gaps and islands problem?

    This is a possible approach using ROW_NUMBER(). Maybe someone can get a better solution as I don't like to sort...

    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: Best way to skip code if certain condition not met in stored procedure

    Another option, according to what I understood.

    IF EXISTS(SELECT 1 FROM MyQuery)

    INSERT INTO MyDestination( mycolumns)

    SELECT mycolumns FROM MyQuery

    The exists will stop at 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: Add calculated row item - SQL 2008

    This is what I thought, but I'm not sure if it helps because I still don't know the logic to differentiate one group from the other.

    CREATE TABLE #Products

    (

    product...

    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 - 5,101 through 5,115 (of 8,731 total)